Files
mixtape/zero.Web.UI/App/app.vue
T

75 lines
1.5 KiB
Vue
Raw Normal View History

2020-03-23 20:05:02 +01:00
<template>
<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'
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: () => ({
isAuthenticated: false,
keyIndex: 0
2020-04-09 11:48:34 +02:00
}),
computed: {
appKey()
{
return 'appkey-' + this.keyIndex;
}
},
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 =>
{
this.isAuthenticated = isAuthenticated;
});
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
};
},
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>