mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
do not query if data is already there
This commit is contained in:
parent
687d93882a
commit
517cc2c88a
1 changed files with 3 additions and 1 deletions
|
@ -15,7 +15,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async 'FETCH' ({ commit }, uri) {
|
async 'FETCH' ({ state, commit }, { uri, force = false }) {
|
||||||
|
// if data has already been queried, simply return
|
||||||
|
if (state[uri] !== undefined && !force) return
|
||||||
return api.get(uri).then(responseData => {
|
return api.get(uri).then(responseData => {
|
||||||
const data = responseData[uri] ? responseData[uri] : responseData
|
const data = responseData[uri] ? responseData[uri] : responseData
|
||||||
commit('SET_' + uri.toUpperCase(), data)
|
commit('SET_' + uri.toUpperCase(), data)
|
||||||
|
|
Loading…
Add table
Reference in a new issue