Refactor components. Improve design. Improve routing
This commit is contained in:
@@ -5,6 +5,7 @@ import { ref } from 'vue';
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
const currentUser = ref<Models.User<Models.Preferences> | null>(null);
|
||||
const ready = ref(false);
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
@@ -12,6 +13,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
} catch {
|
||||
currentUser.value = null;
|
||||
}
|
||||
ready.value = true;
|
||||
}
|
||||
|
||||
async function register(email: string, password: string) {
|
||||
@@ -27,5 +29,5 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
return account.deleteSession('current').then((currentUser.value = null));
|
||||
}
|
||||
|
||||
return { currentUser, register, login, logout, init };
|
||||
return { currentUser, register, login, logout, init, ready };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user