default backend to framadate demo api

This commit is contained in:
tykayn 2021-04-28 16:21:54 +02:00 committed by Baptiste Lemoine
parent e61542b652
commit b2b8056b7e
4 changed files with 16 additions and 9 deletions

View File

@ -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',
},
});
}
//////////

View File

@ -2,7 +2,6 @@
<section class="poll_loaded padded" *ngIf="!fetching && poll">
<div class="well debug">
<!-- infos locales storage-->
debug: {{ storageService.vote_stack | json }}
</div>
<!-- messages-->

View File

@ -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',

View File

@ -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"
}