From e19acc6bab7fbc35feb99afa2ebdd7f2adbae796 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Sun, 19 Dec 2021 20:11:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=88=E8=B1=A1=E5=BE=81=E6=80=A7=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E4=B8=80=E4=B8=8Btmp=E5=88=B7=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Flows.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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({