-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
I am trying to use the code as a base for a similar app, however, I encounter an issue that when I use the AuthService from another Service class,
this.auth.getUser always return null
ClassRoomService class
async create(title, text) {
console.log(title, text);
const user = await this.auth.getUser();
if (user) {
console.log(user);
console.log(user.id);
}
else {
console.log("user is null")
}
}
I wonder what is wrong with the code, would you be kind to give me some advice ?
Forgot to mention, I add a new function for anonymousLogin in AuthService
anonymousLogin() {
return this.afAuth.auth.signInAnonymously()
.then(() => console.log("successful login"))
.catch(error => console.log(error));
}
In component script
this.authService.anonymousLogin().then(() => {
console.log("in anonymousLogin");
this.classRoomService.create(this.act_title, this.act_text); --> the "async create function"
Metadata
Metadata
Assignees
Labels
No labels