Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4415e9508e |
+9
-1
@@ -92,11 +92,19 @@ export const useAuthStore = defineStore("auth", () => {
|
||||
}
|
||||
|
||||
async function checkAuth() {
|
||||
isLoading.value = true;
|
||||
if (token.value) {
|
||||
if (user.value) {
|
||||
try {
|
||||
apiClient.defaults.headers.common["Authorization"] = `Bearer ${token.value}`;
|
||||
const response = await apiClient.get("/api/user/me");
|
||||
user.value = response.data;
|
||||
await fetchUserProfile();
|
||||
} catch (e) {
|
||||
console.error("Session restoration failed:", e);
|
||||
handleLogout();
|
||||
}
|
||||
}
|
||||
isLoading.value = false;
|
||||
}
|
||||
return {
|
||||
// State
|
||||
|
||||
Reference in new issue
Block a user