Add logout button
This commit is contained in:
parent
d9b3012153
commit
18d054edf0
@ -3,9 +3,12 @@
|
||||
|
||||
<container>
|
||||
<p>
|
||||
<span v-if="!!tokenId">Authenticated with token ID {{ tokenId }}</span><br/>
|
||||
<span v-if="!!tokenId">Authenticated with token ID {{ tokenId }}</span>
|
||||
<br/>
|
||||
Authentication status: {{ status ? 'Valid' : 'Invalid' }}
|
||||
<button @click="checkValidity">Refresh</button>
|
||||
<br/>
|
||||
<button @click="logout">Logout</button>
|
||||
</p>
|
||||
</container>
|
||||
</template>
|
||||
@ -57,7 +60,17 @@ export default {
|
||||
return tokenData.token;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
logout() {
|
||||
axios.defaults.headers.common.Authorization = null;
|
||||
|
||||
if (!!window.localStorage.getItem('authentication-token')) {
|
||||
window.localStorage.removeItem('authentication-token');
|
||||
}
|
||||
|
||||
this.status = false;
|
||||
this.tokenId = null;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user