mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-22 12:57:01 -04:00
ReviewDB: proper multi account support
This commit is contained in:
parent
664dd0a992
commit
c0f2c97458
9 changed files with 143 additions and 90 deletions
|
@ -20,8 +20,7 @@ import { definePluginSettings } from "@api/Settings";
|
|||
import { OptionType } from "@utils/types";
|
||||
import { Button } from "@webpack/common";
|
||||
|
||||
import { ReviewDBUser } from "./entities";
|
||||
import { authorize } from "./utils";
|
||||
import { authorize, getToken } from "./auth";
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
authorize: {
|
||||
|
@ -57,10 +56,11 @@ export const settings = definePluginSettings({
|
|||
type: OptionType.COMPONENT,
|
||||
description: "ReviewDB website",
|
||||
component: () => (
|
||||
<Button onClick={() => {
|
||||
<Button onClick={async () => {
|
||||
let url = "https://reviewdb.mantikafasi.dev/";
|
||||
if (settings.store.token)
|
||||
url += "/api/redirect?token=" + encodeURIComponent(settings.store.token);
|
||||
const token = await getToken();
|
||||
if (token)
|
||||
url += "/api/redirect?token=" + encodeURIComponent(token);
|
||||
|
||||
VencordNative.native.openExternal(url);
|
||||
}}>
|
||||
|
@ -80,8 +80,6 @@ export const settings = definePluginSettings({
|
|||
)
|
||||
}
|
||||
}).withPrivateSettings<{
|
||||
token?: string;
|
||||
user?: ReviewDBUser;
|
||||
lastReviewId?: number;
|
||||
reviewsDropdownState?: boolean;
|
||||
}>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue