Fix poll options not rendering text after vote/refresh (#10189)
* Fix poll options not rendering text after vote/refresh * Fix poll options not showing up on public pages * Fix code style issue
This commit is contained in:
parent
57643557b6
commit
fd128b9c7a
4 changed files with 18 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
import api from '../api';
|
||||
import { importFetchedPoll } from './importer';
|
||||
|
||||
export const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST';
|
||||
export const POLL_VOTE_SUCCESS = 'POLL_VOTE_SUCCESS';
|
||||
|
@ -12,7 +13,10 @@ export const vote = (pollId, choices) => (dispatch, getState) => {
|
|||
dispatch(voteRequest());
|
||||
|
||||
api(getState).post(`/api/v1/polls/${pollId}/votes`, { choices })
|
||||
.then(({ data }) => dispatch(voteSuccess(data)))
|
||||
.then(({ data }) => {
|
||||
dispatch(importFetchedPoll(data));
|
||||
dispatch(voteSuccess(data));
|
||||
})
|
||||
.catch(err => dispatch(voteFail(err)));
|
||||
};
|
||||
|
||||
|
@ -20,7 +24,10 @@ export const fetchPoll = pollId => (dispatch, getState) => {
|
|||
dispatch(fetchPollRequest());
|
||||
|
||||
api(getState).get(`/api/v1/polls/${pollId}`)
|
||||
.then(({ data }) => dispatch(fetchPollSuccess(data)))
|
||||
.then(({ data }) => {
|
||||
dispatch(importFetchedPoll(data));
|
||||
dispatch(fetchPollSuccess(data));
|
||||
})
|
||||
.catch(err => dispatch(fetchPollFail(err)));
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue