idek man
Some checks failed
Some checks failed
This commit is contained in:
parent
e848b548b5
commit
242b72ca45
7 changed files with 55 additions and 26 deletions
|
@ -25,19 +25,12 @@ export class UserService {
|
|||
}
|
||||
|
||||
public getOrCreateUser(profile: any): Observable<User> {
|
||||
console.log(profile);
|
||||
const id = profile.info.sub;
|
||||
const username = profile.info.preferred_username;
|
||||
|
||||
return this.getUser(id).pipe(
|
||||
switchMap((user) => {
|
||||
if (user) {
|
||||
return of(user);
|
||||
} else {
|
||||
return this.createUser(id, username);
|
||||
}
|
||||
}),
|
||||
catchError(() => EMPTY)
|
||||
);
|
||||
try {
|
||||
return this.getUser(id) as Observable<User>;
|
||||
} catch (error) {
|
||||
return this.createUser(id, username);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue