You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { Component } from '@angular/core';
|
|
|
|
import { CacheTokenService } from './service/cache-token.service';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.scss']
|
|
|
|
})
|
|
|
|
export class AppComponent {
|
|
|
|
constructor(public token: CacheTokenService) { }
|
|
|
|
ngOnInit() {
|
|
|
|
if (sessionStorage.getItem('token') && !this.token.timer) {
|
|
|
|
//调用服务中的function刷新token
|
|
|
|
this.token.startUp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|