fix: poll
This commit is contained in:
35
src/Flows.js
35
src/Flows.js
@@ -927,22 +927,25 @@ class FlowItemRow extends PureComponent {
|
|||||||
if (ans.option === vote) ans.votes += 1;
|
if (ans.option === vote) ans.votes += 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({
|
this.setState(
|
||||||
info: Object.assign({}, info, { poll: current_poll }),
|
{
|
||||||
});
|
info: Object.assign({}, info, { poll: current_poll }),
|
||||||
|
},
|
||||||
API.add_vote(vote, info.pid, this.props.token)
|
() => {
|
||||||
.then((json) => {
|
API.add_vote(vote, info.pid, this.props.token)
|
||||||
if (json.code !== 0) return;
|
.then((json) => {
|
||||||
localStorage['VOTE_RECORD:' + info.pid] = vote;
|
if (json.code !== 0) return;
|
||||||
this.setState((prev, props) => ({
|
localStorage['VOTE_RECORD:' + info.pid] = vote;
|
||||||
info: Object.assign({}, prev.info, { poll: json.data }),
|
this.setState((prev, props) => ({
|
||||||
}));
|
info: Object.assign({}, prev.info, { poll: json.data }),
|
||||||
})
|
}));
|
||||||
.catch((e) => {
|
})
|
||||||
console.error(e);
|
.catch((e) => {
|
||||||
alert('投票失败');
|
console.error(e);
|
||||||
});
|
alert('投票失败');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_replies(callback, update_count = true) {
|
load_replies(callback, update_count = true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user