bug fix in user check login and jump to login page
This commit is contained in:
parent
56964c96b7
commit
b1ce11930e
|
@ -48,7 +48,25 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
async mounted() {
|
||||||
|
// بررسی وضعیت لاگین کاربر
|
||||||
|
try {
|
||||||
|
const loginCheck = await axios.post('/api/user/check/login');
|
||||||
|
if (loginCheck.data.Success !== true) {
|
||||||
|
// اگر کاربر لاگین نباشد، توکن را حذف کرده و به صفحه ورود هدایت میکنیم
|
||||||
|
localStorage.removeItem('X-AUTH-TOKEN');
|
||||||
|
delete axios.defaults.headers.common['X-AUTH-TOKEN'];
|
||||||
|
this.$router.push('/user/login');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// در صورت خطا در بررسی لاگین، توکن را حذف کرده و به صفحه ورود هدایت میکنیم
|
||||||
|
localStorage.removeItem('X-AUTH-TOKEN');
|
||||||
|
delete axios.defaults.headers.common['X-AUTH-TOKEN'];
|
||||||
|
this.$router.push('/user/login');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
axios.post('/api/plugin/get/actives').then((response) => {
|
axios.post('/api/plugin/get/actives').then((response) => {
|
||||||
this.plugins = response.data;
|
this.plugins = response.data;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue