diff --git a/app/ayanova/src/api/locale.js b/app/ayanova/src/api/locale.js index 636e337c..2a023fd2 100644 --- a/app/ayanova/src/api/locale.js +++ b/app/ayanova/src/api/locale.js @@ -23,8 +23,19 @@ Methods const lt = {}; export default { - async Get(keys) {}, + async Get(keys) { + this.PreFetch(keys); + //TODO: return they keys / lt array + }, async PreFetch(keys) { + //step 1: build an array of keys that we don't have already + var NeedIt = []; + keys.forEach(key => { + if (!has(lt, key)) { + NeedIt.push(key); + } + }); + //todo: make this work with the locale route to get teh batch of keys and store into the lt object fetch(config.apiUrl + "auth", { method: "post", @@ -34,18 +45,17 @@ export default { "Content-Type": "application/json" }, body: JSON.stringify({ - login: login, - password: password + login: "", + password: "" }) }) .then(api.status) .then(api.json) - .then(processLogin) + .then(() => { return Promise.resolve(true); }) //succeeded, nothing to return .catch(function(error) { - processLogout(); return Promise.reject(error); }); },