how to set token Login And and how to remove token Logout
signIn(){
var $$ = this.Dom7
const self = this;
self.$f7.dialog.preloader();
var that = this;
this.$f7.request.promise.postJSON(‘http://localhost:50682/api/Auth/ClinetLogin’, { clinet_Phone:this.username, clinet_Password: this.password })
.then(function (res) {
if(res){
localStorage.setItem(‘token’, res.data.data);
localStorage.setItem(‘name’, res.data.message);
that.$f7router.navigate("/home/");
self.$f7.dialog.close();
}
}).catch(function (err) {
f7.dialog.alert(‘خطا في معلومات الحساب’ );
self.$f7.dialog.close();
}) }
logout(){
var that = this;
localStorage.clear(‘token’);
localStorage.clear(‘name’);
that.$f7router.navigate("/");
}
when i login agine the requset.setup send old token
app.js
var token = localStorage.getItem(‘token’)
Framework7.request.setup({
headers: {
‘Authorization’: 'Bearer '+ token
}
})