mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
trying to send vot stack but getting CORS issue
This commit is contained in:
parent
7a83beae8e
commit
30d4adec37
@ -43,6 +43,8 @@ export class ApiService {
|
||||
this.axiosInstance.defaults.headers.post['Charset'] = 'UTF-8';
|
||||
this.axiosInstance.defaults.headers.post['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS';
|
||||
this.axiosInstance.defaults.headers.post['Access-Control-Allow-Origin'] = '*';
|
||||
|
||||
console.log('this.axiosInstance.defaults.headers', this.axiosInstance.defaults.headers);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@ -101,15 +103,6 @@ export class ApiService {
|
||||
poll,
|
||||
ApiService.makeHeaders()
|
||||
);
|
||||
|
||||
// try {
|
||||
// console.log('currentApiRoutes', currentApiRoutes);
|
||||
// return await this.axiosInstance.post(`${apiBaseHref}${currentApiRoutes['api_new_poll']}`, {
|
||||
// data: poll,
|
||||
// });
|
||||
// } catch (error) {
|
||||
// ApiService.handleError(error);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,14 +110,16 @@ export class ApiService {
|
||||
* @param poll
|
||||
* @param vote_stack
|
||||
*/
|
||||
public async sendVoteStackOfPoll(poll: Poll, vote_stack: Stack) {
|
||||
public sendVoteStackOfPoll(poll: Poll, vote_stack: Stack) {
|
||||
// api_new_vote_stack POST ANY ANY /api/v1/poll/{id}/answer
|
||||
|
||||
console.log('vote_stack', vote_stack);
|
||||
console.log('this.baseHref', this.baseHref);
|
||||
let headers = ApiService.makeHeaders(vote_stack);
|
||||
console.log('headers', headers);
|
||||
|
||||
try {
|
||||
return await this.axiosInstance.post(`${this.pollsEndpoint}/${poll.custom_url}/answer`, vote_stack);
|
||||
return this.axiosInstance.post(`${this.pollsEndpoint}/${poll.custom_url}/answer`, vote_stack, headers);
|
||||
} catch (error) {
|
||||
ApiService.handleError(error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user