diff options
author | Manti <67705577+mantikafasi@users.noreply.github.com> | 2023-05-14 02:29:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-14 01:29:13 +0200 |
commit | 7a27de892767aa8d9104ef16fe5ba2a2a75568cf (patch) | |
tree | 1602ecfb2e134e9c6c8ec05325e5d17d093eac17 /src/plugins/reviewDB/Utils | |
parent | 1bc06784226ed93b33698000cab70d17cb22639b (diff) | |
download | Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.tar.gz Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.tar.bz2 Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.zip |
[ReviewDB] Improve UI & Use new RewviewDB api endpoints (#1104)
Diffstat (limited to 'src/plugins/reviewDB/Utils')
-rw-r--r-- | src/plugins/reviewDB/Utils/Utils.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/reviewDB/Utils/Utils.tsx b/src/plugins/reviewDB/Utils/Utils.tsx index d09c8d4..42426b2 100644 --- a/src/plugins/reviewDB/Utils/Utils.tsx +++ b/src/plugins/reviewDB/Utils/Utils.tsx @@ -44,20 +44,19 @@ export function authorize(callback?: any) { {...props} scopes={["identify"]} responseType="code" - redirectUri="https://manti.vendicated.dev/URauth" + redirectUri="https://manti.vendicated.dev/api/reviewdb/auth" permissions={0n} clientId="915703782174752809" cancelCompletesFlow={false} callback={async (u: string) => { try { const url = new URL(u); - url.searchParams.append("returnType", "json"); url.searchParams.append("clientMod", "vencord"); const res = await fetch(url, { headers: new Headers({ Accept: "application/json" }) }); - const { token, status } = await res.json(); - if (status === 0) { + const { token, success } = await res.json(); + if (success) { Settings.plugins.ReviewDB.token = token; showToast("Successfully logged in!"); callback?.(); @@ -65,7 +64,7 @@ export function authorize(callback?: any) { showToast("An Error occurred while logging in."); } } catch (e) { - new Logger("ReviewDB").error("Failed to authorise", e); + new Logger("ReviewDB").error("Failed to authorize", e); } }} /> @@ -86,5 +85,5 @@ export function showToast(text: string) { export const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)); export function canDeleteReview(review: Review, userId: string) { - if (review.sender.discordID === userId || Settings.plugins.ReviewDB.userType === UserType.Admin) return true; + if (review.sender.discordID === userId || Settings.plugins.ReviewDB.user?.type === UserType.Admin) return true; } |