Skip to content

Commit

Permalink
Merge pull request #18 from snowron/master
Browse files Browse the repository at this point in the history
fix Issue #10 and parsing localstorage error
  • Loading branch information
talented authored Jul 4, 2021
2 parents e5a9dc2 + 3b50766 commit 6647dcc
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/components/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<v-app-bar app color="primary" dark>
<div class="d-flex align-center">
<v-img
alt="Vuetify Logo"
class="shrink mr-2"
@click="redirectToHome()"
alt="Devnot mentor logo"
class="shrink mr-2 pointer"
contain
src="../assets/logo.png"
transition="scale-transition"
Expand Down Expand Up @@ -31,18 +32,30 @@
export default {
data() {
return {
showLogin: false,
showLogin: true,
username: null,
};
},
created() {
this.username = JSON.parse(
window.localStorage.getItem("user-profile")
).name;
this.showLogin =
window.localStorage.getItem("user-profile") == null ? true : false;
if (window.localStorage.getItem("user-profile")) {
this.username = JSON.parse(
window.localStorage.getItem("user-profile")
).name;
this.showLogin = false;
}
},
methods: {
redirectToHome() {
if (this.$route.path !== "/") {
this.$router.push("/");
}
},
},
};
</script>

<style scoped></style>
<style scoped>
.pointer {
cursor: pointer;
}
</style>

1 comment on commit 6647dcc

@vercel
Copy link

@vercel vercel bot commented on 6647dcc Jul 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.