do not query if data is already there

This commit is contained in:
Axolotle 2020-07-16 19:18:01 +02:00
parent 687d93882a
commit 517cc2c88a

View file

@ -15,7 +15,9 @@ export default {
}
},
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 => {
const data = responseData[uri] ? responseData[uri] : responseData
commit('SET_' + uri.toUpperCase(), data)