mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
e7cc2757c3
Co-authored-by: Alexander Lichter <manniL@gmx.net>
35 lines
604 B
Vue
35 lines
604 B
Vue
<template>
|
|
<div>
|
|
<div v-if="$store.state.auth">
|
|
<p>
|
|
You are authenticated. You can see the
|
|
<NuxtLink to="/secret">
|
|
secret page
|
|
</NuxtLink>!
|
|
</p>
|
|
<button @click="logout">
|
|
Logout
|
|
</button>
|
|
</div>
|
|
<p v-else>
|
|
Please
|
|
<NuxtLink to="/login">
|
|
login
|
|
</NuxtLink>.
|
|
</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
const Cookie = process.client ? require('js-cookie') : undefined
|
|
|
|
export default {
|
|
methods: {
|
|
logout () {
|
|
Cookie.remove('auth')
|
|
this.$store.commit('setAuth', null)
|
|
}
|
|
}
|
|
}
|
|
</script>
|