diff --git a/apps/dafa-web/src/app/shared/models/disability.model.ts b/apps/dafa-web/src/app/shared/models/disability.model.ts index de490a7..9608b05 100644 --- a/apps/dafa-web/src/app/shared/models/disability.model.ts +++ b/apps/dafa-web/src/app/shared/models/disability.model.ts @@ -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 }; } diff --git a/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts b/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts index 7fbddc3..d88878f 100644 --- a/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts +++ b/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts @@ -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 { return this.httpClient - .get<{ data: DisabilitiesResponse }>(`${this._apiBaseUrl}/work/disability/${id}`, { ...API_HEADERS }) + .get(`${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 { + // 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 { return this.httpClient .get<{ data: WorkExperiencesResponse }>(`${this._apiBaseUrl}/work/${id}`, { ...API_HEADERS }) diff --git a/apps/dafa-web/src/app/shared/services/api/user.service.ts b/apps/dafa-web/src/app/shared/services/api/user.service.ts index 620b143..f4d2bd9 100644 --- a/apps/dafa-web/src/app/shared/services/api/user.service.ts +++ b/apps/dafa-web/src/app/shared/services/api/user.service.ts @@ -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 = this.httpClient - .get(this._userApiUrl, API_HEADERS) - .pipe(map(response => mapUserApiResponseToUser(response.data))); + public user$: Observable = this.httpClient.get(this._userApiUrl, API_HEADERS).pipe( + filter(response => !!response.data), + map(response => mapUserApiResponseToUser(response.data)) + ); constructor(private httpClient: HttpClient) {} } diff --git a/config/proxy.conf.api.json b/config/proxy.conf.api.json index 2c64448..1c2c64b 100644 --- a/config/proxy.conf.api.json +++ b/config/proxy.conf.api.json @@ -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