This commit is contained in:
Baptiste Lemoine 2020-01-23 10:16:55 +00:00
parent 346bd9dc4f
commit 7e4e80f1ed
2 changed files with 17 additions and 3 deletions

View File

@ -307,6 +307,20 @@ export class ConfigService extends PollConfig {
);
}
/**
* conversion to send to back
* @param choiceList
*/
convertChoicesAnsweredToSend(choiceList) {
const converted = choiceList.map(elem => {
return {
choice_id: elem.id,
value: elem.answer
}
});
console.log('converted', converted);
return converted;
}
/**
* POST
@ -318,11 +332,11 @@ export class ConfigService extends PollConfig {
voteStack = {
pseudo: this.myName,
email: this.myEmail,
answers: this.answers
votes: this.convertChoicesAnsweredToSend(this.currentPoll.choices),
}
}
this.http.post(
`${this.baseHref}/poll/${this.pollId}/vote`,
`${this.baseHref}/poll/${this.currentPoll.id}/vote`,
voteStack,
this.makeHeaders())
.subscribe((res: any) => {

View File

@ -4,4 +4,4 @@ git pull origin dev
yarn install --pure-lockfile
yarn build:demo
sudo cp -r ./dist/framadate/* ../framadate-api/public/
echo " now check update demo at https://framadate-api.cipherbliss.com/index.html "
echo " now check update demo at https://framadate-api.cipherbliss.com"