This commit is contained in:
2025-11-30 13:37:19 +01:00
parent 665f0d1454
commit de2692f704
9 changed files with 50 additions and 122 deletions

View File

@@ -63,13 +63,18 @@ export const useAuthStore = defineStore("auth", {
},
async login(email: string, password: string) {
console.log("Auth login")
const { token } = await useNuxtApp().$api("/auth/login", {
method: "POST",
body: { email, password }
})
console.log(token)
await this.fetchMe(token)
try {
console.log("Auth login")
const { token } = await useNuxtApp().$api("/auth/login", {
method: "POST",
body: { email, password }
})
console.log("Token: " + token)
await this.fetchMe(token)
} catch (e) {
console.log("login error:" + e)
}
},
async logout() {
@@ -105,6 +110,7 @@ export const useAuthStore = defineStore("auth", {
jwt
}}
})
console.log(me)
this.user = me.user
this.permissions = me.permissions
this.tenants = me.tenants
@@ -143,7 +149,7 @@ export const useAuthStore = defineStore("auth", {
const {token} = res
if(await useCapacitor().getIsNative()) {
if(useCapacitor().getIsNative()) {
await Preferences.set({
key:"token",
value: token,