Rewrite
This commit is contained in:
parent
42b66714aa
commit
ac8b334eee
35 changed files with 541 additions and 675 deletions
19
static/js/sync.mjs
Normal file
19
static/js/sync.mjs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { API } from 'api'
|
||||
|
||||
export class Sync {
|
||||
static async tree() {
|
||||
let oldMax = 0
|
||||
nodeStore.getAppState('latest_sync')
|
||||
.then(state => {
|
||||
if (state !== null) {
|
||||
oldMax = state.value
|
||||
return state.value
|
||||
}
|
||||
return 0
|
||||
})
|
||||
.then(sequence => API.query('POST', `/node/tree/${sequence}`, {}))
|
||||
.then(res => nodeStore.updateTreeRecords(res.Nodes))
|
||||
.then(newMax => nodeStore.setAppState('latest_sync', Math.max(oldMax, newMax)))
|
||||
.catch(e => alert(e))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue