feat: work

This commit is contained in:
TheClashFruit 2023-08-24 16:40:40 +02:00
parent 4f1a2ce105
commit 3b8d3aa7f9
Signed by: TheClashFruit
GPG key ID: CF4A319B9A73290C

View file

@ -1,6 +1,6 @@
const DiscordApi = { const DiscordApi = {
getUser: async () => { getUser: async () => {
if (typeof localStorage.getItem('token') === undefined) if (typeof localStorage.getItem('token') !== "string")
return null; return null;
const req = await fetch('https://discord.com/api/v10/users/@me', { const req = await fetch('https://discord.com/api/v10/users/@me', {
@ -14,7 +14,7 @@ const DiscordApi = {
return await req.json(); return await req.json();
}, },
refreshToken: () => { refreshToken: () => {
if (typeof localStorage.getItem('refresh') === undefined) if (typeof localStorage.getItem('refresh') !== "string")
return null; return null;
fetch('https://crss-api.theclashfruit.workers.dev/refresh', { fetch('https://crss-api.theclashfruit.workers.dev/refresh', {