|
1 |
| -import {EventEmitter, Inject, Injectable} from '@angular/core'; |
| 1 | +import {EventEmitter, Injectable} from '@angular/core'; |
2 | 2 | import {AngularFireAuth} from 'angularfire2/auth';
|
3 | 3 | import {ISignInProcess, ISignUpProcess} from '../interfaces/main.interface';
|
4 | 4 | import {FirestoreSyncService} from './firestore-sync.service';
|
5 | 5 | import * as firebase from 'firebase';
|
6 | 6 | import {User, UserInfo} from 'firebase';
|
7 | 7 |
|
8 | 8 | import {Accounts} from '../components/enums';
|
9 |
| -import {NgBootstrapAuthFirebaseUIConfig, NgBootstrapAuthFirebaseUIConfigToken} from '../../..'; |
| 9 | + |
10 | 10 | // import User = firebase.User;
|
11 | 11 | import GoogleAuthProvider = firebase.auth.GoogleAuthProvider;
|
12 | 12 | import FacebookAuthProvider = firebase.auth.FacebookAuthProvider;
|
@@ -35,7 +35,6 @@ export class AuthProcessService implements ISignInProcess, ISignUpProcess {
|
35 | 35 | emailToConfirm: string;
|
36 | 36 |
|
37 | 37 | constructor(public auth: AngularFireAuth,
|
38 |
| - @Inject(NgBootstrapAuthFirebaseUIConfigToken) private config: NgBootstrapAuthFirebaseUIConfig, |
39 | 38 | private _fireStoreService: FirestoreSyncService) {
|
40 | 39 | }
|
41 | 40 |
|
@@ -141,10 +140,12 @@ export class AuthProcessService implements ISignInProcess, ISignUpProcess {
|
141 | 140 | await user.sendEmailVerification();
|
142 | 141 | await this.updateProfile(name, user.photoURL);
|
143 | 142 | this.emailConfirmationSent = true;
|
| 143 | + console.log('emailConfirmationSent = ', this.emailConfirmationSent); |
144 | 144 | this.emailToConfirm = email;
|
145 | 145 |
|
146 | 146 | await this.handleSuccess(userCredential);
|
147 | 147 | } catch (err) {
|
| 148 | + console.error(err); |
148 | 149 | this.handleError(err);
|
149 | 150 | } finally {
|
150 | 151 | this.isLoading = false;
|
@@ -206,17 +207,17 @@ export class AuthProcessService implements ISignInProcess, ISignUpProcess {
|
206 | 207 |
|
207 | 208 | await this._fireStoreService.updateUserData(this.parseUserInfo(userCredential.user));
|
208 | 209 |
|
209 |
| - if (this.config.toastMessageOnAuthSuccess) { |
| 210 | + // if (this.config.toastMessageOnAuthSuccess) { |
210 | 211 | // this._snackBar.open(`Hallo ${userCredential.user.displayName ? userCredential.user.displayName : ''}!`,
|
211 | 212 | // 'OK', {duration: 5000});
|
212 |
| - } |
| 213 | + // } |
213 | 214 | this.onSuccessEmitter.next(userCredential.user);
|
214 | 215 | }
|
215 | 216 |
|
216 | 217 | handleError(error: any) {
|
217 |
| - if (this.config.toastMessageOnAuthError) { |
| 218 | + // if (this.config.toastMessageOnAuthError) { |
218 | 219 | // this._snackBar.open(error.message, 'OK', {duration: 5000});
|
219 |
| - } |
| 220 | + // } |
220 | 221 | console.error(error);
|
221 | 222 | this.onErrorEmitter.next(error);
|
222 | 223 | }
|
|
0 commit comments