From c211fe388e0f0b240cf374807c2acd8d6e69c52a Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Fri, 20 Nov 2020 16:15:44 +0100 Subject: [PATCH] fix: api config to make to work both with backend and mock api --- proxy.conf.json | 10 ++++++++-- src/app/services/structure-list.service.ts | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/proxy.conf.json b/proxy.conf.json index 6c9d77bee..70c21305f 100644 --- a/proxy.conf.json +++ b/proxy.conf.json @@ -1,6 +1,12 @@ { - "/api": { - "target": "http://localhost:3000" + "/api/*": { + "target": "http://localhost:3000", + "secure": false, + "changeOrigin": true, + "logLevel": "debug", + "pathRewrite": { + "^/api": "" + } }, "/base-adresse/base-adresse-nationale/streets": { "target": "https://passerelle.formulaireextranet.grandlyon.com", diff --git a/src/app/services/structure-list.service.ts b/src/app/services/structure-list.service.ts index 853256af6..faf14254c 100644 --- a/src/app/services/structure-list.service.ts +++ b/src/app/services/structure-list.service.ts @@ -18,7 +18,7 @@ export class StructureService { constructor(private http: HttpClient) {} public getStructures(filters: Filter[]): Observable<Structure[]> { - return this.http.get('/api/Structures').pipe(map((data: any[]) => data.map((item) => new Structure(item)))); + return this.http.get('/api/structures').pipe(map((data: any[]) => data.map((item) => new Structure(item)))); } /** -- GitLab