Fixed some Redirects for Mobile
Fixed other Login stuff on mobile
This commit is contained in:
@@ -16,7 +16,12 @@ export const useAuthStore = defineStore("auth", {
|
||||
actions: {
|
||||
async init(token) {
|
||||
await this.fetchMe(token)
|
||||
navigateTo("/")
|
||||
|
||||
if(useCapacitor().getIsNative()) {
|
||||
navigateTo("/mobile")
|
||||
} else {
|
||||
navigateTo("/")
|
||||
}
|
||||
},
|
||||
|
||||
async login(email: string, password: string) {
|
||||
@@ -24,7 +29,7 @@ export const useAuthStore = defineStore("auth", {
|
||||
method: "POST",
|
||||
body: { email, password }
|
||||
})
|
||||
if(await useCapacitor().getIsNative()) {
|
||||
if(useCapacitor().getIsNative()) {
|
||||
await Preferences.set({
|
||||
key:"token",
|
||||
value: token,
|
||||
@@ -49,7 +54,7 @@ export const useAuthStore = defineStore("auth", {
|
||||
this.tenants = []
|
||||
if(useCapacitor().getIsNative()) {
|
||||
await Preferences.remove({ key: 'token' });
|
||||
|
||||
useCookie("token").value = null
|
||||
} else {
|
||||
useCookie("token").value = null
|
||||
}
|
||||
@@ -77,7 +82,7 @@ export const useAuthStore = defineStore("auth", {
|
||||
|
||||
this.profile = me.profile
|
||||
|
||||
if(me.activeTenant) {
|
||||
if(me.activeTenant > 0) {
|
||||
this.activeTenant = me.activeTenant
|
||||
this.activeTenantData = me.tenants.find(i => i.id === me.activeTenant)
|
||||
this.loading = false
|
||||
@@ -112,7 +117,11 @@ export const useAuthStore = defineStore("auth", {
|
||||
|
||||
}
|
||||
await this.init(token)
|
||||
navigateTo("/")
|
||||
if(useCapacitor().getIsNative()) {
|
||||
navigateTo("/mobile")
|
||||
} else {
|
||||
navigateTo("/")
|
||||
}
|
||||
},
|
||||
|
||||
hasPermission(key: string) {
|
||||
|
||||
Reference in New Issue
Block a user