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

Loading…
Cancel
Save