Merge pull request ' Add login service' (#3) from api-connection into master

Reviewed-on: #3
pull/4/head
Maxence JOUANNET 4 months ago
commit beeee17412

@ -49,7 +49,13 @@
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
"sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
}
},
"defaultConfiguration": "production"

@ -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…
Cancel
Save