Skip to content

Commit c48d5bb

Browse files
authored
Merge pull request #202 from wp99cp/develop
Fix signin with Google
2 parents f5c886e + 6625c79 commit c48d5bb

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@emeal/menuplanung",
3-
"version": "1.14.8",
3+
"version": "1.14.9",
44
"license": "MIT",
5-
"copyrights": "© 2019 - 2022 Cevi Züri 11 - eMeal Menüplanung",
5+
"copyrights": "© 2019 - 2023 Cevi Züri 11 - eMeal Menüplanung",
66
"scripts": {
77
"ng": "ng",
88
"start": "angular-build-info && ng serve --ssl",

frontend/src/app/modules/application-module/services/authentication.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ export class AuthenticationService {
4242
* Authenticates a Firebase client using a full-page redirect flow with the GoogleAuthProvider
4343
*
4444
*/
45-
signInWithGoogle() {
45+
async signInWithGoogle() {
4646

4747
this.location.replaceState('login/oauth-callback?method=google');
48-
this.fireAuth.signInWithRedirect(new firebase.auth.GoogleAuthProvider())
49-
.then(console.log)
48+
this.fireAuth.signInWithPopup(new firebase.auth.GoogleAuthProvider())
49+
.then(() => this.router.navigate(['/app']))
5050
.catch(console.error);
5151

5252
}

frontend/src/app/modules/application-module/services/settings.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {FirestoreSettings, UserGroups} from '../interfaces/firestoreDatatypes';
22
import {AuthenticationService} from './authentication.service';
3-
import {map, mergeMap} from 'rxjs/operators';
3+
import {filter, map, mergeMap, tap} from 'rxjs/operators';
44
import {Injectable} from '@angular/core';
55
import {Observable} from 'rxjs';
66
import {AngularFirestore, AngularFirestoreDocument} from '@angular/fire/compat/firestore';
@@ -23,8 +23,10 @@ export class SettingsService {
2323

2424
constructor(private db: AngularFirestore, authService: AuthenticationService) {
2525

26-
this.globalSettings = authService.getCurrentUser().pipe(mergeMap(user =>
27-
this.loadUserSettings(user.uid)));
26+
this.globalSettings = authService.getCurrentUser()
27+
.pipe(tap(console.log))
28+
.pipe(filter(user => !!user?.uid))
29+
.pipe(mergeMap(user => this.loadUserSettings(user.uid)));
2830

2931
}
3032

0 commit comments

Comments
 (0)