Mobile
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user