forked from newthuhole/hole_thu_frontend
清理文件 同步更新likenum
This commit is contained in:
10
.travis.yml
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
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webhole",
|
||||
"version": "0.3.1",
|
||||
"version": "1.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
|
||||
16
src/Flows.js
16
src/Flows.js
@@ -369,6 +369,7 @@ class FlowSidebar extends PureComponent {
|
||||
info: update_count
|
||||
? Object.assign({}, prev.info, {
|
||||
reply: '' + json.data.length,
|
||||
likenum: ''+json.likenum,
|
||||
})
|
||||
: prev.info,
|
||||
attention: !!json.attention,
|
||||
@@ -405,15 +406,22 @@ class FlowSidebar extends PureComponent {
|
||||
this.setState({
|
||||
loading_status: 'loading',
|
||||
});
|
||||
const next_attention = !this.state.attention;
|
||||
API.set_attention(this.state.info.pid, next_attention, this.props.token)
|
||||
const prev_info = this.state.info;
|
||||
API.set_attention(this.state.info.pid, !this.state.attention, this.props.token)
|
||||
.then((json) => {
|
||||
this.setState({
|
||||
loading_status: 'done',
|
||||
attention: next_attention,
|
||||
attention: json.attention,
|
||||
info: Object.assign({}, prev_info, {
|
||||
likenum: ''+json.likenum,
|
||||
}),
|
||||
});
|
||||
console.log(json);
|
||||
this.syncState({
|
||||
attention: next_attention,
|
||||
attention: json.attention,
|
||||
info: Object.assign({}, prev_info, {
|
||||
likenum: ''+json.likenum,
|
||||
}),
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
|
||||
Reference in New Issue
Block a user