98. Login service call (#12)
This commit is contained in:
7
support-portal-frontend/src/app/dto/user-login.spec.ts
Normal file
7
support-portal-frontend/src/app/dto/user-login.spec.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import {UserLogin} from './user-login';
|
||||||
|
|
||||||
|
describe('UserLogin', () => {
|
||||||
|
it('should create an instance', () => {
|
||||||
|
expect(new UserLogin()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
4
support-portal-frontend/src/app/dto/user-login.ts
Normal file
4
support-portal-frontend/src/app/dto/user-login.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export class UserLogin {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
@ -1,9 +1,22 @@
|
|||||||
import {Injectable} from '@angular/core';
|
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({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AuthenticationService {
|
export class AuthenticationService {
|
||||||
|
|
||||||
constructor() { }
|
private host: string = environment.apiUrl;
|
||||||
|
|
||||||
|
constructor(private httpClient: HttpClient) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public login(userDto: UserLogin): Observable<HttpResponse<any> | HttpErrorResponse> {
|
||||||
|
return this.httpClient.post<HttpResponse<any> | HttpErrorResponse>(`${this.host}/user/login`, userDto, {observe: 'response'});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
"strictPropertyInitialization": false,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user