diff --git a/src/app/core/services/api.service.ts b/src/app/core/services/api.service.ts index e0dfa4a7..b4a427e9 100644 --- a/src/app/core/services/api.service.ts +++ b/src/app/core/services/api.service.ts @@ -21,7 +21,6 @@ const apiEndpoints = environment.api.endpoints; }) export class ApiService { private static loader: LoaderService; - private http: HttpClient; private useDevLocalServer = true; private devLocalServerBaseHref = 'http://localhost:8000/'; private axiosInstance: AxiosInstance; @@ -117,9 +116,9 @@ export class ApiService { console.log('vote_stack', vote_stack); console.log('this.baseHref', this.baseHref); - let headers = ApiService.makeHeaders(); + let headers = ApiService.makeHeaders(vote_stack); console.log('headers', headers); - let url = `${this.baseHref}/${poll.custom_url}/answer`; + let url = `${this.baseHref}/poll/${poll.custom_url}/answer`; let axiosconf = { url, @@ -128,7 +127,14 @@ export class ApiService { headers, }; - return this.http.post(url, vote_stack, headers); + return this.http.post(url, vote_stack, { + headers: { + 'Access-Control-Allow-Origin': '*', + 'Content-Type': 'application/json', + 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', + 'Access-Control-Allow-Headers': 'Accept,Accept-Language,Content-Language,Content-Type', + }, + }); } ////////// diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index 56dcac16..6acc730f 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -2,7 +2,6 @@
- debug: {{ storageService.vote_stack | json }}
diff --git a/src/environments/environment.ts b/src/environments/environment.ts index d9fa6cb8..229e5d01 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,10 +4,12 @@ const backendApiUrlsInDev = { local: '/api/v1', - remote: 'http://localhost:8000/api/v1', + // remote: 'http://localhost:8000/api/v1', + remote: 'https://framadate-api.cipherbliss.com/api/v1', }; const apiV1 = { - baseHref: 'http://localhost:8000/api/v1', + // baseHref: 'http://localhost:8000/api/v1', + baseHref: 'https://framadate-api.cipherbliss.com/api/v1', api_new_poll: '/poll/', api_get_poll: '/poll/{id}', api_new_vote_stack: '/poll/{id}/answer', diff --git a/src/proxy.conf.json b/src/proxy.conf.json index 244c8195..7cb97ba5 100644 --- a/src/proxy.conf.json +++ b/src/proxy.conf.json @@ -1,6 +1,6 @@ { - "/api/*": { - "target": "http://localhost:8000/api", + "/api": { + "target": "http://localhost:8000/api/v1/poll/aujourdhui-ou-demain/answer", "secure": false, "logLevel": "debug" }