Merge pull request '✨ Add login service' (#3) from api-connection into master
Reviewed-on: #3pull/4/head
commit
beeee17412
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoginService } from './login.service';
|
||||
|
||||
describe('LoginService', () => {
|
||||
let service: LoginService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(LoginService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class LoginService {
|
||||
private apiUrl = environment.apiURL;
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
login(username: string, password: string): Observable<any> {
|
||||
return this.http.get(this.apiUrl + '/login', {
|
||||
params: {
|
||||
username: username,
|
||||
password: password,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiURL: 'https://api.memorymap.fr/api/v1',
|
||||
};
|
@ -0,0 +1,4 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
apiURL: 'https://api.memorymap.fr/api/v1',
|
||||
};
|
Loading…
Reference in new issue