Updated api-call for disabilities
This commit is contained in:
@@ -12,6 +12,6 @@ export function mapResponseToDisability(data: DisabilityResponse): Disability {
|
||||
return {
|
||||
code: kod,
|
||||
title: funktionsnedsattning, // TODO: Needed from API
|
||||
description: beskrivning || null, //TODO: Needed from API
|
||||
description: beskrivning, //TODO: Needed from API
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
import { environment } from '@dafa-environment';
|
||||
import { ContactInformationResponse } from '@dafa-models/api/contact-information.response.model';
|
||||
import { DeltagareResponse } from '@dafa-models/api/deltagare.response.model';
|
||||
import { DisabilitiesResponse } from '@dafa-models/api/disabilities.response.model';
|
||||
import { DisabilityResponse } from '@dafa-models/api/disability.response.model';
|
||||
import { DriversLicenseResponse } from '@dafa-models/api/drivers-license.response.model';
|
||||
import { EducationsResponse } from '@dafa-models/api/educations.response.model';
|
||||
import { HighestEducationResponse } from '@dafa-models/api/highest-education.response.model';
|
||||
@@ -80,17 +80,26 @@ export class DeltagareService {
|
||||
}
|
||||
private _fetchDisabilities$(id: string): Observable<Disability[]> {
|
||||
return this.httpClient
|
||||
.get<{ data: DisabilitiesResponse }>(`${this._apiBaseUrl}/work/disability/${id}`, { ...API_HEADERS })
|
||||
.get<DisabilityResponse[]>(`${this._apiBaseUrl}/work/disability/${id}`, { ...API_HEADERS })
|
||||
.pipe(
|
||||
map(response =>
|
||||
response.data.funktionsnedsattningar
|
||||
? response.data.funktionsnedsattningar.map(funktionsnedsattning =>
|
||||
mapResponseToDisability(funktionsnedsattning)
|
||||
)
|
||||
: []
|
||||
response ? response.map(funktionsnedsattning => mapResponseToDisability(funktionsnedsattning)) : []
|
||||
)
|
||||
);
|
||||
}
|
||||
// private _fetchDisabilities$(id: string): Observable<Disability[]> {
|
||||
// return this.httpClient
|
||||
// .get<{ data: DisabilitiesResponse }>(`${this._apiBaseUrl}/work/disability/${id}`, { ...API_HEADERS })
|
||||
// .pipe(
|
||||
// map(respoqnse =>
|
||||
// response.data.funktionsnedsattningar
|
||||
// ? response.data.funktionsnedsattningar.map(funktionsnedsattning =>
|
||||
// mapResponseToDisability(funktionsnedsattning)
|
||||
// )
|
||||
// : []
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
private _fetchWorkExperiences$(id: string): Observable<WorkExperience[]> {
|
||||
return this.httpClient
|
||||
.get<{ data: WorkExperiencesResponse }>(`${this._apiBaseUrl}/work/${id}`, { ...API_HEADERS })
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
import { environment } from '@dafa-environment';
|
||||
import { mapUserApiResponseToUser, User, UserApiResponse } from '@dafa-models/user.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
|
||||
const API_HEADERS = { headers: environment.api.headers };
|
||||
|
||||
@@ -12,9 +12,10 @@ const API_HEADERS = { headers: environment.api.headers };
|
||||
})
|
||||
export class UserService {
|
||||
private _userApiUrl = `${environment.api.url}/auth`;
|
||||
public user$: Observable<User> = this.httpClient
|
||||
.get<UserApiResponse>(this._userApiUrl, API_HEADERS)
|
||||
.pipe(map(response => mapUserApiResponseToUser(response.data)));
|
||||
public user$: Observable<User> = this.httpClient.get<UserApiResponse>(this._userApiUrl, API_HEADERS).pipe(
|
||||
filter(response => !!response.data),
|
||||
map(response => mapUserApiResponseToUser(response.data))
|
||||
);
|
||||
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"/api": {
|
||||
// "target": "http://dafa-api-test.tocp.arbetsformedlingen.se",
|
||||
"target": "http://mina-sidor-fa-test-api.tocp.arbetsformedlingen.se",
|
||||
"secure": false,
|
||||
"changeOrigin": true
|
||||
|
||||
Reference in New Issue
Block a user