Browse Source

先象征性避免一下tmp刷票

pull/16/head
hole-thu 4 years ago
parent
commit
e19acc6bab
  1. 8
      src/Flows.js

8
src/Flows.js

@ -359,7 +359,7 @@ class FlowItem extends PureComponent {
onVote={do_vote || (() => {})}
customStyles={{'theme': 'cyan'}}
noStorage={true}
vote={info.poll.vote}
vote={localStorage['VOTE_RECORD:' + info.pid] || info.poll.vote}
/>
</div>
)}
@ -511,17 +511,13 @@ class FlowSidebar extends PureComponent {
}
do_vote(vote) {
this.setState({
loading_status: 'loading',
error_msg: null,
});
API.add_vote(vote, this.state.info.pid, this.props.token)
.then((json) => {
if (json.code !== 0) return;
localStorage['VOTE_RECORD:' + this.state.info.pid] = vote;
this.setState(
(prev, props) => ({
info: Object.assign({}, prev.info, { poll: json.data }),
loading_status: 'done',
}),
() => {
this.syncState({

Loading…
Cancel
Save