environment
This commit is contained in:
@@ -3,7 +3,7 @@ import { inject, Injectable } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BehaviorSubject, Observable, tap, of, catchError } from 'rxjs';
|
||||
import { IUser } from '../../model/interface/user.interface';
|
||||
import { environment } from '../../../environments/environment.development';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { HotToastService } from '@ngxpert/hot-toast';
|
||||
|
||||
@Injectable({
|
||||
@@ -48,10 +48,16 @@ export class AuthService {
|
||||
|
||||
authenticateWithCode(authcode: string) {
|
||||
return new Promise(resolve => {
|
||||
this.http.post<IUser>('/api/auth/auth-code', { code: authcode }).subscribe(user => {
|
||||
this.setTokens({ accessToken: user.accessToken, refreshToken: user.refreshToken});
|
||||
this.user = user;
|
||||
return resolve(true)
|
||||
this.http.post<IUser>('/api/auth/auth-code', { code: authcode }).subscribe({
|
||||
next: user => {
|
||||
this.setTokens({ accessToken: user.accessToken, refreshToken: user.refreshToken});
|
||||
this.user = user;
|
||||
return resolve(true)
|
||||
},
|
||||
error: () => {
|
||||
this.toast.error('Login nicht erfolgreich!');
|
||||
return resolve(null);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user