Refactor components. Improve design. Improve routing

This commit is contained in:
2023-11-17 17:15:37 -05:00
parent cbe4b5323e
commit f2d4ce12d4
17 changed files with 278 additions and 146 deletions

View File

@@ -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 };
});