I need to get back into using git. The hell is wrong with me!?
This commit is contained in:
@@ -1,37 +1,19 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet">
|
||||
<global-site-menu />
|
||||
|
||||
<!-- Hide this menu on the notes page -->
|
||||
<div class="ui basic segment" v-if="
|
||||
this.$router.currentRoute.name != 'NotesPage'
|
||||
">
|
||||
<div class="ui container">
|
||||
<div class="ui tabular menu">
|
||||
|
||||
<router-link class="item" exact-active-class="active" to="/">Home</router-link>
|
||||
<router-link v-if="loggedIn" exact-active-class="active" class="item" to="/notes">Notes</router-link>
|
||||
<router-link class="item" exact-active-class="active" to="/help">Help</router-link>
|
||||
<router-link v-if="!loggedIn" exact-active-class="active" class="item" to="/login">Login</router-link>
|
||||
<div v-if="loggedIn" v-on:click="destroyLoginToken" class="item">Logout</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<router-view/>
|
||||
<router-view />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
'global-site-menu': require('@/components/GlobalSiteMenu.vue').default,
|
||||
},
|
||||
data: function(){
|
||||
return {
|
||||
// loggedIn:
|
||||
@@ -39,6 +21,9 @@ export default {
|
||||
},
|
||||
beforeCreate: function(){
|
||||
|
||||
//Detect if user is on a mobile browser and set a flag in store
|
||||
this.$store.commit('detectIsUserOnMobile')
|
||||
|
||||
//Set color theme based on local storage
|
||||
if(localStorage.getItem('nightMode') == 'true'){
|
||||
this.$store.commit('toggleNightMode')
|
||||
@@ -50,15 +35,11 @@ export default {
|
||||
|
||||
if(token){
|
||||
this.$store.commit('setLoginToken', {token, username})
|
||||
} else {
|
||||
this.$store.commit('destroyLoginToken')
|
||||
this.$router.push({'path':'/'})
|
||||
}
|
||||
|
||||
//Detect if user is on a mobile browser and set a flag in store
|
||||
this.$store.commit('detectIsUserOnMobile')
|
||||
},
|
||||
mounted: function(){
|
||||
|
||||
},
|
||||
computed: {
|
||||
loggedIn () {
|
||||
@@ -69,6 +50,13 @@ export default {
|
||||
methods: {
|
||||
destroyLoginToken() {
|
||||
this.$store.commit('destroyLoginToken')
|
||||
},
|
||||
loginGateway() {
|
||||
if(!this.loggedIn){
|
||||
console.log('This user is not logged in')
|
||||
this.$router.push({'path':'/login'})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user