diff --git a/support-portal-frontend/src/app/dto/user-login.spec.ts b/support-portal-frontend/src/app/dto/user-login.spec.ts new file mode 100644 index 0000000..d18d057 --- /dev/null +++ b/support-portal-frontend/src/app/dto/user-login.spec.ts @@ -0,0 +1,7 @@ +import {UserLogin} from './user-login'; + +describe('UserLogin', () => { + it('should create an instance', () => { + expect(new UserLogin()).toBeTruthy(); + }); +}); diff --git a/support-portal-frontend/src/app/dto/user-login.ts b/support-portal-frontend/src/app/dto/user-login.ts new file mode 100644 index 0000000..29fa7bf --- /dev/null +++ b/support-portal-frontend/src/app/dto/user-login.ts @@ -0,0 +1,4 @@ +export class UserLogin { + username: string; + password: string; +} diff --git a/support-portal-frontend/src/app/service/authentication.service.ts b/support-portal-frontend/src/app/service/authentication.service.ts index 41f8aa9..aa9afd5 100644 --- a/support-portal-frontend/src/app/service/authentication.service.ts +++ b/support-portal-frontend/src/app/service/authentication.service.ts @@ -1,9 +1,22 @@ import {Injectable} from '@angular/core'; +import {environment} from "../../environments/environment"; +import {HttpClient, HttpErrorResponse, HttpResponse} from "@angular/common/http"; +import {UserLogin} from "../dto/user-login"; +import {Observable} from "rxjs"; @Injectable({ providedIn: 'root' }) export class AuthenticationService { - constructor() { } + private host: string = environment.apiUrl; + + constructor(private httpClient: HttpClient) { + } + + public login(userDto: UserLogin): Observable | HttpErrorResponse> { + return this.httpClient.post | HttpErrorResponse>(`${this.host}/user/login`, userDto, {observe: 'response'}); + } + + } diff --git a/support-portal-frontend/tsconfig.json b/support-portal-frontend/tsconfig.json index 6df8283..82954b2 100644 --- a/support-portal-frontend/tsconfig.json +++ b/support-portal-frontend/tsconfig.json @@ -6,6 +6,7 @@ "outDir": "./dist/out-tsc", "forceConsistentCasingInFileNames": true, "strict": true, + "strictPropertyInitialization": false, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "sourceMap": true,