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, OnInit } from '@angular/core';
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
import { CacheTokenService } from 'src/app/service/cache-token.service';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-nav',
|
|
|
|
templateUrl: './nav.component.html',
|
|
|
|
styleUrls: ['./nav.component.scss']
|
|
|
|
})
|
|
|
|
export class NavComponent implements OnInit {
|
|
|
|
|
|
|
|
constructor(private router: Router, public token: CacheTokenService) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
//调用服务中的function刷新token
|
|
|
|
this.token.startUp()
|
|
|
|
}
|
|
|
|
signOut() {
|
|
|
|
this.router.navigate(['/login'])
|
|
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
this.token.delete()
|
|
|
|
}
|
|
|
|
}
|