aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-11-16 01:02:23 +0100
committerVendicated <vendicated@riseup.net>2022-11-16 01:02:23 +0100
commitae86848cf6f87585c87d983d5567119ce9e8b50c (patch)
tree4a5b04f56c620c776d7dac5f991ddcb3be0c6e15
parent84ec839b041a0da2a7a950c47f003d5bebfe4685 (diff)
downloadVencord-ae86848cf6f87585c87d983d5567119ce9e8b50c.tar.gz
Vencord-ae86848cf6f87585c87d983d5567119ce9e8b50c.tar.bz2
Vencord-ae86848cf6f87585c87d983d5567119ce9e8b50c.zip
Fix ReviewDB
-rw-r--r--src/plugins/reviewDB/Utils/ReviewDBAPI.ts9
1 files changed, 5 insertions, 4 deletions
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<Review[]> {
}
export async function addReview(review: any): Promise<Response> {
- 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<any> {
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());