Skip to content

Instantly share code, notes, and snippets.

@blogcacanid
Created November 9, 2020 06:30
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 blogcacanid/78257454f9ac1917cedebe123d088dcc to your computer and use it in GitHub Desktop.
Save blogcacanid/78257454f9ac1917cedebe123d088dcc to your computer and use it in GitHub Desktop.
Profile.vue Authentication JWT Vue Lumen 7
<template>
<div class="container">
<header class="jumbotron">
<h3>Profile</h3>
<h3>
<strong>{{currentUser.username}}</strong>
</h3>
<p>
<strong>Id:</strong>
{{currentUser.id}}
</p>
<p>
<strong>Email:</strong>
{{currentUser.email}}
</p>
<p>
<strong>Member Since:</strong>
{{currentUser.created_at | formatDate}}
</p>
<p>
<strong>Token:</strong>
{{currentUser.accessToken.substring(0, 20)}} ... {{currentUser.accessToken.substr(currentUser.accessToken.length - 20)}}
</p>
</header>
</div>
</template>
<script>
export default {
name: 'Profile',
computed: {
currentUser() {
return this.$store.state.auth.user;
}
},
mounted() {
if (!this.currentUser) {
this.$router.push('/login');
}
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment