Skip to content

Instantly share code, notes, and snippets.

@harryWonder
Created October 26, 2020 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harryWonder/336c583b50a598641eda5eaacaa47f6b to your computer and use it in GitHub Desktop.
Save harryWonder/336c583b50a598641eda5eaacaa47f6b to your computer and use it in GitHub Desktop.
This is the base nav file for all Vue files or components we will be creating.
<template>
<nav>
<div class="container">
<div class="row">
<div class="six columns">
<a href="/" class="application-title"><i class="material-icons">sms</i> Ld-Talk</a>
</div>
<div class="six columns">
<ul v-if="!isLoggedIn">
<li><router-link :to="{ name: 'Welcome' }"><i class="material-icons">lock_open</i> Login</router-link></li>
<li><a href=""><i class="material-icons">local_cafe</i> Buy Me Coffee</a></li>
</ul>
<ul v-else>
<li><router-link :to="{ name: 'Welcome' }"><i class="material-icons">home</i> Home</router-link></li>
<li><a href=""><i class="material-icons">lock_open</i> Logout</a></li>
<li><a href=""><i class="material-icons">local_cafe</i> Buy Me Coffee</a></li>
</ul>
</div>
</div>
</div>
</nav>
</template>
<script type="text/javascript">
import axios from 'axios';
export default {
data() {
return {
isLoggedIn: false
}
},
created() {
let userSecret = localStorage.getItem('access-token');
if (userSecret.trim() !== '') {
this.isLoggedIn = true;
return;
}
this.isLoggedIn = false;
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment