|
|
|
@ -14,7 +14,6 @@ import { CookieService } from 'ngx-cookie-service';
|
|
|
|
|
}) |
|
|
|
|
export class AppComponent { |
|
|
|
|
title = '数据采集管理平台'; |
|
|
|
|
time: number = 2*60*60*1000;// cookie过期时间两个小时 2*60*60*1000
|
|
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,private router:Router,public token:CacheTokenService,private cookieService: CookieService) { } |
|
|
|
|
|
|
|
|
@ -30,8 +29,8 @@ export class AppComponent {
|
|
|
|
|
} |
|
|
|
|
).subscribe( |
|
|
|
|
(data: Data) => { |
|
|
|
|
this.cookieService.set("token",data.token,new Date(new Date().getTime() + this.time),'/'); |
|
|
|
|
this.cookieService.set("refreshToken",data.refreshToken,new Date(new Date().getTime() + this.time),'/'); |
|
|
|
|
this.cookieService.set("token",data.token,null,'/'); |
|
|
|
|
this.cookieService.set("refreshToken",data.refreshToken,null,'/'); |
|
|
|
|
this.token.startUp() |
|
|
|
|
console.log('已重启定时器') |
|
|
|
|
} |
|
|
|
|