This commit is contained in:
2019-03-06 21:35:50 +00:00
parent 60717ac8e0
commit d6a82f902e
3 changed files with 33 additions and 60 deletions

View File

@@ -11,7 +11,9 @@ export default {
}
return store.state.localeText[key];
},
isFetching: false,
fetch(keys) {
this.isFetching = true;
return new Promise(function(resolve, reject) {
//step 1: build an array of keys that we don't have already
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
@@ -23,6 +25,7 @@ export default {
}
if (needIt.length == 0) {
resolve();
this.isFetching = false;
return;
}
//step 2: get it
@@ -34,9 +37,11 @@ export default {
store.commit("addLocaleText", item);
});
resolve();
this.isFetching = false;
})
.catch(function(error) {
reject(error);
this.isFetching = false;
});
});
},