Browse Source

清理文件 同步更新likenum

pull/6/head
hole-thu 5 years ago
parent
commit
aed2c2a9cb
  1. 10
      .travis.yml
  2. 2
      package.json
  3. 16
      src/Flows.js

10
.travis.yml

@ -1,10 +0,0 @@
language: node_js
node_js:
- 12
cache:
directories:
- node_modules
after_success:
- chmod +x ./travis_deploy.sh
- ./travis_deploy.sh

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "webhole", "name": "webhole",
"version": "0.3.1", "version": "1.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"copy-to-clipboard": "^3.3.1", "copy-to-clipboard": "^3.3.1",

16
src/Flows.js

@ -369,6 +369,7 @@ class FlowSidebar extends PureComponent {
info: update_count info: update_count
? Object.assign({}, prev.info, { ? Object.assign({}, prev.info, {
reply: '' + json.data.length, reply: '' + json.data.length,
likenum: ''+json.likenum,
}) })
: prev.info, : prev.info,
attention: !!json.attention, attention: !!json.attention,
@ -405,15 +406,22 @@ class FlowSidebar extends PureComponent {
this.setState({ this.setState({
loading_status: 'loading', loading_status: 'loading',
}); });
const next_attention = !this.state.attention; const prev_info = this.state.info;
API.set_attention(this.state.info.pid, next_attention, this.props.token) API.set_attention(this.state.info.pid, !this.state.attention, this.props.token)
.then((json) => { .then((json) => {
this.setState({ this.setState({
loading_status: 'done', loading_status: 'done',
attention: next_attention, attention: json.attention,
info: Object.assign({}, prev_info, {
likenum: ''+json.likenum,
}),
}); });
console.log(json);
this.syncState({ this.syncState({
attention: next_attention, attention: json.attention,
info: Object.assign({}, prev_info, {
likenum: ''+json.likenum,
}),
}); });
}) })
.catch((e) => { .catch((e) => {

Loading…
Cancel
Save