我有一个 isUserAuthenticated 的对象实例,它在我的 auth.service.ts 中。我想在 .forRoot 内的 Angular 的 App.module.ts 中使用它
应用模块.ts
@NgModule({
declarations: [],
imports: [
..
.forRoot({
}),
],
providers: [],
这里我的 isUserAuthenticated 对象存在于 auth.service.ts
public async isUserAuthenticated(){
if(this._storageService.getToken() !== null){
if(!this._jwtHelperService.isTokenExpired(this._storageService.getToken()?.toString())){
}
else{
if(!this._storageService.refreshTokenExists()){
return false;
}
else{
let authTokenClient: AuthTokenClient = {
token: this._storageService.getToken() as string,
refreshToken: this._storageService.getRefreshToken() as string
};