2 Commits
Author SHA1 Message Date
Sirttas 8a71dad977 fix a couple of things 2026-06-28 22:14:29 +02:00
Sirttas 45ed773119 fix a couple of things 2026-06-28 22:10:34 +02:00
2 changed files with 13 additions and 4 deletions
+9 -2
View File
@@ -1,7 +1,14 @@
import {defineStore} from "pinia";
import {ref} from "vue";
import {CharacterResponse} from "@/generated/mammon";
import {addCharacter as addCharacterRequest, fetchMe, mammonLoginUrl, postLogout, refreshAccessToken, setOnAuthExpired} from "@/mammon";
import {
addCharacter as addCharacterRequest,
fetchMe,
mammonLoginUrl,
postLogout,
refreshAccessToken,
setOnAuthExpired
} from "@/mammon";
import {setAccessToken} from "./token";
export const useAuthStore = defineStore('auth', () => {
@@ -59,7 +66,7 @@ export const useAuthStore = defineStore('auth', () => {
});
if (await refresh()) {
await fetch();
await fetch().catch(() => {});
}
}
+4 -2
View File
@@ -17,10 +17,11 @@ const router = createRouter({
});
app.use(pinia);
app.use(router);
const authStore = useAuthStore();
await authStore.bootstrap();
router.beforeEach(to => {
if (!to.meta.public && !authStore.isAuthenticated) {
return {name: routeNames.home};
@@ -28,4 +29,5 @@ router.beforeEach(to => {
return true;
});
authStore.bootstrap().finally(() => app.mount('#app'));
app.use(router);
app.mount('#app');