diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..77d873b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,243 @@ +# AGENTS.md + +## Project Overview + +`ewa-mobile` is a Vue 3 + Vite + Vant frontend with a Tauri 2 Rust backend. + +The app uses local and remote model resources exposed through `che-tauri`, which is built on top of `che-orm`. Frontend model access should go through the generated TypeScript API in `src/generated`. + +## Main Stack + +- Vue 3 with ` + + + + diff --git a/src/shared/auth/useAuth.ts b/src/shared/auth/useAuth.ts index 6f7e5e0..72352cf 100644 --- a/src/shared/auth/useAuth.ts +++ b/src/shared/auth/useAuth.ts @@ -18,9 +18,7 @@ export function useAuth() { } async function logout() { - authToken.value = ""; - localStorage.removeItem(TOKEN_STORAGE_KEY); - restored = false; + clearAuthState(); await invoke("auth_logout"); } @@ -36,12 +34,19 @@ export function useAuth() { return { authToken, isAuthenticated, + clearAuthState, login, logout, restoreToken, }; } +export function clearAuthState() { + authToken.value = ""; + localStorage.removeItem(TOKEN_STORAGE_KEY); + restored = false; +} + export function isAuthenticated() { return Boolean(authToken.value); }