mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: account state
This commit is contained in:
@@ -13,6 +13,10 @@ function createUserStore() {
|
||||
},
|
||||
logout: async () => {
|
||||
await sdkForConsole.account.deleteSession('current');
|
||||
/**
|
||||
* Clear cache.
|
||||
*/
|
||||
globalThis.sessionStorage.clear();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
try {
|
||||
if (!$user) {
|
||||
await user.fetchUser();
|
||||
} else {
|
||||
user.fetchUser();
|
||||
}
|
||||
|
||||
if (!$page.url.pathname.startsWith('/console')) {
|
||||
@@ -32,7 +34,13 @@
|
||||
} catch (error) {
|
||||
if (acceptedRoutes.includes($page.url.pathname)) {
|
||||
await goto(`${base}${$page.url.pathname}${$page.url.search}`);
|
||||
} else await goto(`${base}/login`);
|
||||
} else {
|
||||
/**
|
||||
* Clear cache.
|
||||
*/
|
||||
window.sessionStorage.clear();
|
||||
await goto(`${base}/login`);
|
||||
}
|
||||
} finally {
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
afterNavigate(handle);
|
||||
|
||||
async function handle(event = null) {
|
||||
if (!$user) {
|
||||
await user.fetchUser();
|
||||
}
|
||||
updateLayout({
|
||||
navigate: event,
|
||||
title: $user?.name,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
const login = async () => {
|
||||
try {
|
||||
await sdkForConsole.account.createEmailSession(mail, pass);
|
||||
user.fetchUser();
|
||||
await user.fetchUser();
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: 'Successfully logged in.'
|
||||
|
||||
Reference in New Issue
Block a user