diff --git a/pages/login.vue b/pages/login.vue
index 1f020f4..84b87fd 100644
--- a/pages/login.vue
+++ b/pages/login.vue
@@ -14,7 +14,11 @@ const doLogin = async (data:any) => {
await auth.login(data.email, data.password)
// Weiterleiten nach erfolgreichem Login
toast.add({title:"Einloggen erfolgreich"})
- return navigateTo("/")
+ if(useCapacitor().getIsNative()) {
+ return navigateTo("/mobile")
+ } else {
+ return navigateTo("/")
+ }
} catch (err: any) {
toast.add({title:"Zugangsdaten falsch. Bitte überprüfen Sie Ihre Eingaben",color:"rose"})
}
diff --git a/pages/mobile/menu.vue b/pages/mobile/menu.vue
index d2c50a8..d5e4a21 100644
--- a/pages/mobile/menu.vue
+++ b/pages/mobile/menu.vue
@@ -65,6 +65,14 @@ const auth = useAuthStore()
>
Objekte
+
+ Abmelden
+
Unternehmen wechseln
diff --git a/stores/auth.ts b/stores/auth.ts
index 883d0ed..3039e26 100644
--- a/stores/auth.ts
+++ b/stores/auth.ts
@@ -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) {