完善路由守卫功能
This commit is contained in:
@@ -33,7 +33,8 @@ export class GlobalUserService {
|
||||
}
|
||||
if (this.lastRequestTime && Date.now() - this.lastRequestTime < 1000) {
|
||||
return {
|
||||
unsubscribe() {
|
||||
unsubscribe: () => {
|
||||
this.userObserverArray.splice(this.userObserverArray.indexOf(observer), 1);
|
||||
observer.complete();
|
||||
}
|
||||
}
|
||||
@@ -44,7 +45,8 @@ export class GlobalUserService {
|
||||
// 获取数据
|
||||
const subscription = this.getUserInfoFromServer();
|
||||
return {
|
||||
unsubscribe() {
|
||||
unsubscribe:()=>{
|
||||
this.userObserverArray.splice(this.userObserverArray.indexOf(observer), 1);
|
||||
observer.complete();
|
||||
subscription.unsubscribe()
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ export class LocalStorageService {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
// 1分钟
|
||||
readonly place = 60 * 1000;
|
||||
// 30s
|
||||
readonly place = 30 * 1000;
|
||||
|
||||
getToken(): string {
|
||||
return localStorage.getItem('token');
|
||||
|
||||
Reference in New Issue
Block a user