Compare commits

...

2 Commits

Author SHA1 Message Date
Igor Hrenowitsch Propisnov 41347f5c1c start using generated api files 2024-05-22 22:07:00 +02:00
Igor Hrenowitsch Propisnov ce9eb9fa70 added base path 2024-05-22 22:06:45 +02:00
2 changed files with 9 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable, tap } from 'rxjs'; import { BehaviorSubject, Observable, tap } from 'rxjs';
import { environment } from '../../../environments/environment'; import { environment } from '../../../environments/environment';
import { AuthenticationApiService } from '../../api/api/authentication.api.service';
import { LoginCredentials, Tokens } from '../types'; import { LoginCredentials, Tokens } from '../types';
import { LocalStorageService } from './local-storage.service'; import { LocalStorageService } from './local-storage.service';
@ -26,28 +27,29 @@ export class AuthService {
public constructor( public constructor(
private readonly httpClient: HttpClient, private readonly httpClient: HttpClient,
private readonly localStorageService: LocalStorageService, private readonly localStorageService: LocalStorageService,
private readonly sessionStorageService: SessionStorageService private readonly sessionStorageService: SessionStorageService,
private readonly authenticationApiService: AuthenticationApiService
) { ) {
this.autoLogin(); this.autoLogin();
} }
public signin(credentials: LoginCredentials): void { public signin(credentials: LoginCredentials): void {
this.httpClient this.authenticationApiService
.post<Tokens>(environment.api.base + `${this._path}/signin`, credentials) .authControllerSignin(credentials)
.subscribe((response: Tokens) => { .subscribe((response: Tokens) => {
this.handleSuccess(response); this.handleSuccess(response);
}); });
} }
public signup(credentials: LoginCredentials): void { public signup(credentials: LoginCredentials): void {
this.httpClient this.authenticationApiService
.post<Tokens>(environment.api.base + `${this._path}/signup`, credentials) .authControllerSignup(credentials)
.subscribe((response: Tokens) => { .subscribe((response: Tokens) => {
//TODO The checked accept terms should be saved with a timestamp in the db
this.handleSuccess(response); this.handleSuccess(response);
}); });
} }
// TODO Implement authControllerSignup
public signout(): void { public signout(): void {
this._access_token = null; this._access_token = null;
this._refresh_token = null; this._refresh_token = null;

View File

@ -9,6 +9,7 @@
"output": "frontend/src/app/api", "output": "frontend/src/app/api",
"inputSpec": "backend/docs/swagger.json", "inputSpec": "backend/docs/swagger.json",
"additionalProperties": { "additionalProperties": {
"basePath": "http://localhost:3000/api",
"npmName": "Ticket-API-Services", "npmName": "Ticket-API-Services",
"npmVersion": "0.0.0", "npmVersion": "0.0.0",
"ngVersion": "17.0.0", "ngVersion": "17.0.0",