Browse Source

[完善] 退出系统清空缓存

master
陈鹏飞 4 years ago
parent
commit
6bbfcc1e58
  1. 1
      src/app/http-interceptors/base-interceptor.ts
  2. 2
      src/app/tabbar/tabbar.component.ts

1
src/app/http-interceptors/base-interceptor.ts

@ -46,6 +46,7 @@ export class BaseInterceptor implements HttpInterceptor {
// 用户认证失败返回登录页
if (error.status === 401||error.status === 614) {
sessionStorage.clear()
localStorage.clear()
this.router.navigate(['/login'])
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';

2
src/app/tabbar/tabbar.component.ts

@ -40,6 +40,7 @@ export class TabbarComponent implements OnInit {
if(out) {
this.http.post('/api/ExamAccounts/SignOut',{}).subscribe(data=>{
sessionStorage.clear()
localStorage.clear()
this.token.delete()
this.router.navigate(['/login'])
const config = new MatSnackBarConfig();
@ -47,7 +48,6 @@ export class TabbarComponent implements OnInit {
config.duration = 3000
this.snackBar.open('退出成功','确定',config);
})
localStorage.removeItem("checkedWork")
} //if
}

Loading…
Cancel
Save