-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from Asadaaaaa/dev/zkaa
Dev/zkaa
- Loading branch information
Showing
8 changed files
with
178 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
export default async function getForyou(auth = null, offset) { | ||
try { | ||
const res = await fetch( | ||
process.env.NEXT_PUBLIC_HOST + | ||
"/" + | ||
process.env.NEXT_PUBLIC_VERSION + | ||
`/project/get/foryou?offset=${offset}&limit=2`, | ||
{ | ||
method: "GET", | ||
headers: { | ||
Accept: "*/*", | ||
"Content-Type": "application/json", | ||
...(auth ? { Authorization: auth } : {}), | ||
}, | ||
} | ||
).then((res) => res.json()); | ||
|
||
if (res.status === 200) { | ||
return { status: "200", data: res.data }; | ||
} else { | ||
if (res.err) { | ||
if (res.err.type === "token") { | ||
export default async function GetForyou(auth = null, offset) { | ||
try { | ||
const res = await fetch( | ||
process.env.NEXT_PUBLIC_HOST + | ||
"/" + | ||
process.env.NEXT_PUBLIC_VERSION + | ||
`/project/get/foryou?offset=${offset}&limit=2`, | ||
{ | ||
method: "GET", | ||
headers: { | ||
Accept: "*/*", | ||
"Content-Type": "application/json", | ||
...(auth ? { Authorization: auth } : {}), | ||
}, | ||
} | ||
).then((res) => res.json()); | ||
|
||
if (res.status === 200) { | ||
return { status: "200", data: res.data }; | ||
} else { | ||
if (res.err) { | ||
if (res.err.type === "token") { | ||
if (res.err.data.code === -3 ) { | ||
return { status: "expired" }; | ||
} else { | ||
return { status: "unauth" }; | ||
} else if (res.err.type === "service") { | ||
return { status: "notfound" }; | ||
} | ||
} else { | ||
return { status: "err" }; | ||
} else if (res.err.type === "service") { | ||
return { status: "notfound" }; | ||
} | ||
} else { | ||
return { status: "err" }; | ||
} | ||
} catch { | ||
return { status: "err" }; | ||
} | ||
} catch { | ||
return { status: "err" }; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.