8dbc1b0503
* chore(package): update standard to version 12.0.0 * package lock update * fix eslint
20 lines
626 B
JavaScript
20 lines
626 B
JavaScript
import { store } from '../_store/store'
|
|
import { getLists } from '../_api/lists'
|
|
import { cacheFirstUpdateAfter } from '../_utils/sync'
|
|
import { database } from '../_database/database'
|
|
|
|
export async function updateLists () {
|
|
let { currentInstance, accessToken } = store.get()
|
|
|
|
await cacheFirstUpdateAfter(
|
|
() => getLists(currentInstance, accessToken),
|
|
() => database.getLists(currentInstance),
|
|
lists => database.setLists(currentInstance, lists),
|
|
lists => {
|
|
let { instanceLists } = store.get()
|
|
instanceLists[currentInstance] = lists
|
|
store.set({ instanceLists: instanceLists })
|
|
}
|
|
)
|
|
}
|