Преглед изворни кода

test de authservice

auth.service test
henri carmelo пре 10 месеци
родитељ
комит
d2038c4ce6

+ 2 - 2
angular-client/src/app/services/auth.service.ts

@@ -16,7 +16,7 @@ import { StorageService } from 'src/app/services/storage.service'; // Assurez-vo
   providedIn: 'root'
 })
 export class AuthService {
-  private apiUrl = `https://api-preprod.foodgame.fr`;
+  private apiUrl = environment.apiUrl;
   private currentUserSubject: BehaviorSubject<User> = new BehaviorSubject<User>(null);
   public currentUser: Observable<User> = this.currentUserSubject.asObservable();
   private tokenSubject: BehaviorSubject<Token>;
@@ -52,7 +52,7 @@ export class AuthService {
   }
 
   signIn(credentials): Observable<Token> {
-    return this.http.post<Token>(`${this.apiUrl}/api/auth/login`, credentials)
+    return this.http.post<Token>(`https://api-preprod.foodgame.fr/api/auth/login`, credentials)
       .pipe(map(token => {
         this.storageService.setItem('token', JSON.stringify(token));
         this.tokenSubject.next(token);

+ 1 - 1
angular-client/src/environments/environment.ts

@@ -3,7 +3,7 @@
 // The list of file replacements can be found in `angular.json`.
 
 export const environment = {
-  production: true,
+  production: false,
   name: "(dev)",
   apiUrl: `https://api-preprod.foodgame.fr`,
 };