refac/fix: signout redirect flow

This commit is contained in:
Timothy Jaeryang Baek
2025-05-17 00:38:39 +04:00
parent fcb93f3155
commit 7df6d7f325
4 changed files with 23 additions and 12 deletions

View File

@@ -347,6 +347,7 @@ export const userSignOut = async () => {
if (error) {
throw error;
}
return res;
};
export const addUser = async (

View File

@@ -156,12 +156,11 @@
<button
class="flex rounded-md py-2 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={async () => {
await userSignOut();
const res = await userSignOut();
user.set(null);
localStorage.removeItem('token');
location.href = '/auth';
location.href = res?.redirect_url ?? '/auth';
show = false;
}}
>

View File

@@ -464,11 +464,11 @@
}
if (now >= exp) {
await userSignOut();
const res = await userSignOut();
user.set(null);
localStorage.removeItem('token');
location.href = '/auth';
location.href = res?.redirect_url ?? '/auth';
}
};