This commit is contained in:
2018-11-14 22:34:41 +00:00
parent 2f92d587e4
commit 105c8c9a78
3 changed files with 19 additions and 16 deletions

View File

@@ -13,23 +13,18 @@ export default {
fetch(keys) {
return new Promise(function(resolve, reject) {
//step 1: build an array of keys that we don't have already
var NeedIt = [];
var needIt = [];
for (var i = 0; i < keys.length; i++) {
if (!_.has(store.state.localeText, keys[i])) {
NeedIt.push(keys[i]);
needIt.push(keys[i]);
}
}
if (NeedIt.length == 0) {
if (needIt.length == 0) {
resolve();
return;
}
//step 2: get it
fetch(apiUtil.APIUrl() + "locale/subset", {
method: "post",
mode: "cors",
headers: apiUtil.PostAuthorizedHeaders(),
body: JSON.stringify(NeedIt)
})
fetch(apiUtil.APIUrl("locale/subset"), apiUtil.fetchPost(needIt))
.then(apiUtil.status)
.then(apiUtil.json)
.then(response => {