From ae86848cf6f87585c87d983d5567119ce9e8b50c Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 16 Nov 2022 01:02:23 +0100 Subject: Fix ReviewDB --- src/plugins/reviewDB/Utils/ReviewDBAPI.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/plugins/reviewDB') diff --git a/src/plugins/reviewDB/Utils/ReviewDBAPI.ts b/src/plugins/reviewDB/Utils/ReviewDBAPI.ts index cd4199d..71e6e81 100644 --- a/src/plugins/reviewDB/Utils/ReviewDBAPI.ts +++ b/src/plugins/reviewDB/Utils/ReviewDBAPI.ts @@ -20,9 +20,10 @@ import { Settings } from "../../../Vencord"; import { Review } from "../entities/Review"; import { authorize, showToast } from "./Utils"; -const settings = Settings.plugins.ReviewDB; const API_URL = "https://manti.vendicated.dev"; +const getToken = () => Settings.plugins.ReviewDB.token; + enum Response { "Added your review" = 0, "Updated your review" = 1, @@ -35,7 +36,7 @@ export async function getReviews(id: string): Promise { } export async function addReview(review: any): Promise { - review.token = settings.token; + review.token = getToken(); if (!review.token) { showToast("Please authorize to add a review."); @@ -65,7 +66,7 @@ export function deleteReview(id: number): Promise { Accept: "application/json", }), body: JSON.stringify({ - token: settings.token, + token: getToken(), reviewid: id }) }).then(r => r.json()); @@ -80,7 +81,7 @@ export async function reportReview(id: number) { }), body: JSON.stringify({ reviewid: id, - token: settings.token + token: getToken() }) }); showToast(await res.text()); -- cgit