Skip to content

Instantly share code, notes, and snippets.

@pipethedev
Created June 18, 2020 10:56
Show Gist options
  • Select an option

  • Save pipethedev/69993281ea01b975bfaac60c06dc8ff5 to your computer and use it in GitHub Desktop.

Select an option

Save pipethedev/69993281ea01b975bfaac60c06dc8ff5 to your computer and use it in GitHub Desktop.
<template>
<ul>
<li>
{{ user }}
<router-link :to="{name:'home'}">Home</router-link>
</li>
<template v-if="authenticated">
<li>
<router-link :to="{name:'signin'}">Sign In</router-link>
</li>
<li>
{{user.name}}
</li>
<li>
<router-link :to="{name:'dashboard'}">Dashboard</router-link>
</li>
<li>
<a href="#"> Log Out</a>
</li>
</template>
<template v-else>
<router-link :to="{name: 'signin'}">SignIn</router-link>
</template>
</ul>
</template>
<script>
import { mapGetters } from 'vuex'
export default{
computed : {
...mapGetters({
authenticated: 'auth/authenticated',
user: 'auth/user',
})
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment