Skip to content

Commit

Permalink
ditch axios
Browse files Browse the repository at this point in the history
  • Loading branch information
backmeupplz committed Oct 28, 2022
1 parent 985da39 commit e0509b5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 84 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"prepublishOnly": "yarn lint && yarn build"
},
"dependencies": {
"axios": "^1.1.3",
"node-fetch": "^3.2.10",
"node-persist": "^3.1.0"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/helpers/fetchNotifications.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Notification } from '../models/Notification'
import axios from 'axios'
import fetch from 'node-fetch'

export default function (next: string, address: string) {
return axios.get<{
return fetch(
next ||
`https://api.farcaster.xyz/v1/notifications?address=${address}&per_page=10`
).then((res) => res.json()) as Promise<{
result: {
notifications?: { [key: string]: Notification }
}
meta?: {
next?: string
}
}>(
next ||
`https://api.farcaster.xyz/v1/notifications?address=${address}&per_page=10`
)
}>
}
3 changes: 1 addition & 2 deletions src/helpers/startPolling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ async function pollNotifications(
let next = ''
const notifications = [] as Notification[]
do {
const result = await fetchNotifications(next, farcasterAddress)
const data = result.data
const data = await fetchNotifications(next, farcasterAddress)
notifications.push(...Object.values(data.result.notifications || {}))
if (currentNotificationId) {
next = data.meta?.next || ''
Expand Down
123 changes: 48 additions & 75 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ __metadata:
"@types/node-persist": ^3.1.3
"@typescript-eslint/eslint-plugin": ^5.41.0
"@typescript-eslint/parser": ^5.41.0
axios: ^1.1.3
eslint: ^8.26.0
eslint-config-prettier: ^8.5.0
eslint-plugin-import: ^2.26.0
eslint-plugin-node: ^11.1.0
eslint-plugin-prettier: ^4.2.1
eslint-plugin-sort-imports-es6-autofix: ^0.6.0
node-fetch: ^3.2.10
node-persist: ^3.1.0
np: ^7.6.2
prettier: ^2.7.1
Expand Down Expand Up @@ -579,24 +579,6 @@ __metadata:
languageName: node
linkType: hard

"asynckit@npm:^0.4.0":
version: 0.4.0
resolution: "asynckit@npm:0.4.0"
checksum: 7b78c451df768adba04e2d02e63e2d0bf3b07adcd6e42b4cf665cb7ce899bedd344c69a1dcbce355b5f972d597b25aaa1c1742b52cffd9caccb22f348114f6be
languageName: node
linkType: hard

"axios@npm:^1.1.3":
version: 1.1.3
resolution: "axios@npm:1.1.3"
dependencies:
follow-redirects: ^1.15.0
form-data: ^4.0.0
proxy-from-env: ^1.1.0
checksum: cab3b17bf6092c9387f7023d699db093cfa23650b56c4422cd474d124b78b2e3b5a520f932c330664a58ab85b867b1c25a95cace475ef72d236888c852b84e6d
languageName: node
linkType: hard

"balanced-match@npm:^1.0.0":
version: 1.0.2
resolution: "balanced-match@npm:1.0.2"
Expand Down Expand Up @@ -880,15 +862,6 @@ __metadata:
languageName: node
linkType: hard

"combined-stream@npm:^1.0.8":
version: 1.0.8
resolution: "combined-stream@npm:1.0.8"
dependencies:
delayed-stream: ~1.0.0
checksum: 49fa4aeb4916567e33ea81d088f6584749fc90c7abec76fd516bf1c5aa5c79f3584b5ba3de6b86d26ddd64bae5329c4c7479343250cfe71c75bb366eae53bb7c
languageName: node
linkType: hard

"concat-map@npm:0.0.1":
version: 0.0.1
resolution: "concat-map@npm:0.0.1"
Expand Down Expand Up @@ -941,6 +914,13 @@ __metadata:
languageName: node
linkType: hard

"data-uri-to-buffer@npm:^4.0.0":
version: 4.0.0
resolution: "data-uri-to-buffer@npm:4.0.0"
checksum: a010653869abe8bb51259432894ac62c52bf79ad761d418d94396f48c346f2ae739c46b254e8bb5987bded8a653d467db1968db3a69bab1d33aa5567baa5cfc7
languageName: node
linkType: hard

"date-fns@npm:^1.27.2":
version: 1.30.1
resolution: "date-fns@npm:1.30.1"
Expand Down Expand Up @@ -1078,13 +1058,6 @@ __metadata:
languageName: node
linkType: hard

"delayed-stream@npm:~1.0.0":
version: 1.0.0
resolution: "delayed-stream@npm:1.0.0"
checksum: 46fe6e83e2cb1d85ba50bd52803c68be9bd953282fa7096f51fc29edd5d67ff84ff753c51966061e5ba7cb5e47ef6d36a91924eddb7f3f3483b1c560f77a0020
languageName: node
linkType: hard

"dir-glob@npm:^3.0.1":
version: 3.0.1
resolution: "dir-glob@npm:3.0.1"
Expand Down Expand Up @@ -1580,6 +1553,16 @@ __metadata:
languageName: node
linkType: hard

"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4":
version: 3.2.0
resolution: "fetch-blob@npm:3.2.0"
dependencies:
node-domexception: ^1.0.0
web-streams-polyfill: ^3.0.3
checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf
languageName: node
linkType: hard

"figures@npm:^1.7.0":
version: 1.7.0
resolution: "figures@npm:1.7.0"
Expand Down Expand Up @@ -1672,24 +1655,12 @@ __metadata:
languageName: node
linkType: hard

"follow-redirects@npm:^1.15.0":
version: 1.15.2
resolution: "follow-redirects@npm:1.15.2"
peerDependenciesMeta:
debug:
optional: true
checksum: faa66059b66358ba65c234c2f2a37fcec029dc22775f35d9ad6abac56003268baf41e55f9ee645957b32c7d9f62baf1f0b906e68267276f54ec4b4c597c2b190
languageName: node
linkType: hard

"form-data@npm:^4.0.0":
version: 4.0.0
resolution: "form-data@npm:4.0.0"
"formdata-polyfill@npm:^4.0.10":
version: 4.0.10
resolution: "formdata-polyfill@npm:4.0.10"
dependencies:
asynckit: ^0.4.0
combined-stream: ^1.0.8
mime-types: ^2.1.12
checksum: 01135bf8675f9d5c61ff18e2e2932f719ca4de964e3be90ef4c36aacfc7b9cb2fceb5eca0b7e0190e3383fe51c5b37f4cb80b62ca06a99aaabfcfd6ac7c9328c
fetch-blob: ^3.1.2
checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db
languageName: node
linkType: hard

Expand Down Expand Up @@ -2900,22 +2871,6 @@ __metadata:
languageName: node
linkType: hard

"mime-db@npm:1.52.0":
version: 1.52.0
resolution: "mime-db@npm:1.52.0"
checksum: 0d99a03585f8b39d68182803b12ac601d9c01abfa28ec56204fa330bc9f3d1c5e14beb049bafadb3dbdf646dfb94b87e24d4ec7b31b7279ef906a8ea9b6a513f
languageName: node
linkType: hard

"mime-types@npm:^2.1.12":
version: 2.1.35
resolution: "mime-types@npm:2.1.35"
dependencies:
mime-db: 1.52.0
checksum: 89a5b7f1def9f3af5dad6496c5ed50191ae4331cc5389d7c521c8ad28d5fdad2d06fd81baf38fed813dc4e46bb55c8145bb0ff406330818c9cf712fb2e9b3836
languageName: node
linkType: hard

"mimic-fn@npm:^1.0.0":
version: 1.2.0
resolution: "mimic-fn@npm:1.2.0"
Expand Down Expand Up @@ -3052,6 +3007,24 @@ __metadata:
languageName: node
linkType: hard

"node-domexception@npm:^1.0.0":
version: 1.0.0
resolution: "node-domexception@npm:1.0.0"
checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f
languageName: node
linkType: hard

"node-fetch@npm:^3.2.10":
version: 3.2.10
resolution: "node-fetch@npm:3.2.10"
dependencies:
data-uri-to-buffer: ^4.0.0
fetch-blob: ^3.1.4
formdata-polyfill: ^4.0.10
checksum: e65322431f4897ded04197aa5923eaec63a8d53e00432de4e70a4f7006625c8dc32629c5c35f4fe8ee719a4825544d07bf53f6e146a7265914262f493e8deac1
languageName: node
linkType: hard

"node-persist@npm:^3.1.0":
version: 3.1.0
resolution: "node-persist@npm:3.1.0"
Expand Down Expand Up @@ -3608,13 +3581,6 @@ __metadata:
languageName: node
linkType: hard

"proxy-from-env@npm:^1.1.0":
version: 1.1.0
resolution: "proxy-from-env@npm:1.1.0"
checksum: ed7fcc2ba0a33404958e34d95d18638249a68c430e30fcb6c478497d72739ba64ce9810a24f53a7d921d0c065e5b78e3822759800698167256b04659366ca4d4
languageName: node
linkType: hard

"pump@npm:^3.0.0":
version: 3.0.0
resolution: "pump@npm:3.0.0"
Expand Down Expand Up @@ -4505,6 +4471,13 @@ __metadata:
languageName: node
linkType: hard

"web-streams-polyfill@npm:^3.0.3":
version: 3.2.1
resolution: "web-streams-polyfill@npm:3.2.1"
checksum: b119c78574b6d65935e35098c2afdcd752b84268e18746606af149e3c424e15621b6f1ff0b42b2676dc012fc4f0d313f964b41a4b5031e525faa03997457da02
languageName: node
linkType: hard

"which-boxed-primitive@npm:^1.0.2":
version: 1.0.2
resolution: "which-boxed-primitive@npm:1.0.2"
Expand Down

0 comments on commit e0509b5

Please sign in to comment.