diff --git a/src/Flows.js b/src/Flows.js index 01f5d9d..ed58d0b 100644 --- a/src/Flows.js +++ b/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} /> )} @@ -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({