2FAuth/resources/js/views/App.vue

56 lines
1.9 KiB
Vue
Raw Normal View History

2019-05-28 17:29:15 +02:00
<template>
<div>
<nav class="navbar is-black level is-mobile has-text-grey-lighter">
<div class="level-left">
2020-01-06 16:58:31 +01:00
<router-link :to="{ name: 'accounts' }" class="is-size-4 has-text-weight-light">2FAccount</router-link>
</div>
<div class="level-right">
2020-01-06 10:10:18 +01:00
<p class="level-item" v-if="isLoggedIn">
<router-link :to="{ name: 'create' }" class="button is-black">
<span class="icon has-text-grey-light">
<font-awesome-icon :icon="['fas', 'plus-circle']" />
</span>
</router-link>
</p>
<p class="level-item" v-if="!isLoggedIn">
<router-link :to="{ name: 'login' }" class="button is-black">
2020-01-06 16:58:31 +01:00
Sign in
</router-link>
</p>
<p class="level-item" v-else>
<router-link :to="{ name: 'sign out' }" class="button is-black">
Sign out
</router-link>
</p>
<p class="level-item" v-if="!isLoggedIn">
<router-link :to="{ name: 'register' }" class="button is-black">
Register
</router-link>
</p>
<p class="level-item" v-if="isLoggedIn">
Hi, {{username}}
</p>
2019-05-28 17:29:15 +02:00
</div>
</nav>
2019-05-28 17:29:15 +02:00
<main class="py-4">
<router-view></router-view>
</main>
</div>
</template>
<script>
export default {
name: 'App',
2019-05-28 17:29:15 +02:00
data(){
return {
isLoggedIn : null,
username : null
2019-05-28 17:29:15 +02:00
}
},
mounted(){
this.isLoggedIn = localStorage.getItem('jwt')
this.username = localStorage.getItem('user')
2019-05-28 17:29:15 +02:00
}
}
</script>