fix reviewdb auth not working on userscript (#2194)
This commit is contained in:
parent
604f4c49af
commit
f922f0bc0d
|
@ -59,7 +59,7 @@ export function authorize(callback?: any) {
|
|||
const url = new URL(response.location);
|
||||
url.searchParams.append("clientMod", "vencord");
|
||||
const res = await fetch(url, {
|
||||
headers: new Headers({ Accept: "application/json" })
|
||||
headers: { Accept: "application/json" }
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
|
|
|
@ -118,10 +118,10 @@ export async function addReview(review: any): Promise<Response | null> {
|
|||
export async function deleteReview(id: number): Promise<Response | null> {
|
||||
return await rdbRequest(`/users/${id}/reviews`, {
|
||||
method: "DELETE",
|
||||
headers: new Headers({
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
}),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
reviewid: id
|
||||
})
|
||||
|
@ -135,10 +135,10 @@ export async function deleteReview(id: number): Promise<Response | null> {
|
|||
export async function reportReview(id: number) {
|
||||
const res = await rdbRequest("/reports", {
|
||||
method: "PUT",
|
||||
headers: new Headers({
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
}),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
reviewid: id,
|
||||
})
|
||||
|
@ -150,10 +150,10 @@ export async function reportReview(id: number) {
|
|||
async function patchBlock(action: "block" | "unblock", userId: string) {
|
||||
const res = await rdbRequest("/blocks", {
|
||||
method: "PATCH",
|
||||
headers: new Headers({
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
}),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: action,
|
||||
discordId: userId
|
||||
|
@ -180,9 +180,9 @@ export const unblockUser = (userId: string) => patchBlock("unblock", userId);
|
|||
export async function fetchBlocks(): Promise<ReviewDBUser[]> {
|
||||
const res = await rdbRequest("/blocks", {
|
||||
method: "GET",
|
||||
headers: new Headers({
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
if (!res.ok) throw new Error(`${res.status}: ${res.statusText}`);
|
||||
|
|
Loading…
Reference in a new issue