[英]Why can't I access the property from the AuthResponseData interface?
I just wrote this code, but I can't access the property of the AuthResponseData interface (in the signup-method).我刚刚编写了这段代码,但我无法访问 AuthResponseData 接口的属性(在注册方法中)。 I'm using Firebase as my backend.
我使用 Firebase 作为我的后端。
export interface AuthResponseData{
kind:string,
idToken:string,
email:string,
refreshToken:string,
expiresIn:string,
localId:string,
registered?:string
}
@Injectable({
providedIn:'root'
})
export class AuthService{
user = new Subject<User>();
constructor(private http: HttpClient){}
signup(email:string, password:string){
return this.http.post<AuthResponseData>('https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyAurYt47nxuRQNu9qseIdmD_aL1pmpw3lU',
{
email: email,
password: password,
returnSecureToken: true
}).pipe(catchError(this.handleError), tap(resData => {
** Here I want to write: 'console.log(resData.expiresIn)'**. Actually what I really want to
write is more complex, but I wanted to make this problem easier to understand.
}))
}
}
}
I guess the observable returned by signup
is not subscribed by anyone.我想
signup
返回的可观察值没有被任何人订阅。
HTTP post will not be issued until it is subscribed by anyone. HTTP 帖子只有在有人订阅后才会发出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.