2020-03-23 20:05:02 +01:00
|
|
|
<template>
|
2021-03-04 16:03:37 +01:00
|
|
|
<div class="app" :class="getClassList()" :key="appKey">
|
2020-04-09 11:48:34 +02:00
|
|
|
<template v-if="isAuthenticated">
|
2020-10-15 14:10:38 +02:00
|
|
|
<app-navigation />
|
2020-04-09 11:48:34 +02:00
|
|
|
<div class="app-main">
|
|
|
|
|
<router-view></router-view>
|
|
|
|
|
</div>
|
2020-10-15 14:10:38 +02:00
|
|
|
<app-overlays />
|
|
|
|
|
<app-notifications />
|
2020-04-09 11:48:34 +02:00
|
|
|
</template>
|
2020-10-15 14:10:38 +02:00
|
|
|
<app-login v-else />
|
2020-03-23 20:05:02 +01:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-10-15 16:03:28 +02:00
|
|
|
import '../sass/app.scss'
|
2020-10-15 14:10:38 +02:00
|
|
|
import AppNavigation from 'zero/navigation.vue'
|
|
|
|
|
import AppLogin from 'zero/pages/login/login.vue'
|
|
|
|
|
import AppOverlays from 'zero/components/overlays/overlay-holder.vue'
|
|
|
|
|
import AppNotifications from 'zero/components/notifications/notification-holder.vue'
|
2020-11-20 10:32:17 +01:00
|
|
|
import EventHub from 'zero/helpers/eventhub.js';
|
|
|
|
|
import AuthApi from 'zero/helpers/auth.js'
|
2020-03-23 20:05:02 +01:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'app',
|
|
|
|
|
|
2020-10-15 14:10:38 +02:00
|
|
|
components: { AppNavigation, AppOverlays, AppLogin, AppNotifications },
|
2020-04-09 11:48:34 +02:00
|
|
|
|
|
|
|
|
data: () => ({
|
2021-03-04 16:03:37 +01:00
|
|
|
isAuthenticated: false,
|
|
|
|
|
keyIndex: 0
|
2020-04-09 11:48:34 +02:00
|
|
|
}),
|
|
|
|
|
|
2021-03-04 16:03:37 +01:00
|
|
|
computed: {
|
|
|
|
|
appKey()
|
|
|
|
|
{
|
|
|
|
|
return 'appkey-' + this.keyIndex;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-10 13:35:39 +02:00
|
|
|
created()
|
2020-04-09 11:48:34 +02:00
|
|
|
{
|
2020-10-16 14:02:10 +02:00
|
|
|
AuthApi.setUser(__zero.user);
|
|
|
|
|
|
2020-10-15 14:10:38 +02:00
|
|
|
AuthApi.$on('authenticated', isAuthenticated =>
|
2020-04-10 13:35:39 +02:00
|
|
|
{
|
|
|
|
|
this.isAuthenticated = isAuthenticated;
|
|
|
|
|
});
|
2021-03-04 16:03:37 +01:00
|
|
|
|
|
|
|
|
AuthApi.$on('appswitch', data =>
|
|
|
|
|
{
|
|
|
|
|
this.rerender();
|
|
|
|
|
//this.isAuthenticated = isAuthenticated;
|
|
|
|
|
});
|
2020-09-04 15:28:06 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
getClassList()
|
|
|
|
|
{
|
|
|
|
|
return {
|
2020-10-16 11:23:54 +02:00
|
|
|
'is-preview': false //this.$route.name === 'preview'
|
2020-09-04 15:28:06 +02:00
|
|
|
};
|
2021-03-04 16:03:37 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
rerender()
|
|
|
|
|
{
|
|
|
|
|
this.keyIndex += 1;
|
2020-09-04 15:28:06 +02:00
|
|
|
}
|
2020-04-09 11:48:34 +02:00
|
|
|
}
|
2020-03-23 20:05:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|