This commit is contained in:
2018-11-12 21:09:42 +00:00
parent d761b3b0cb
commit c9de558a06
7 changed files with 100 additions and 64 deletions

View File

@@ -1,7 +1,8 @@
import config from "../utils/config";
import api from "./apiutil";
import has from "../utils/lodash/map";
import _ from "../utils/libs/core.min.js";
import { getToken } from "../utils/authUtil";
/* eslint-disable */
/*
Locale:
Methods
@@ -30,24 +31,20 @@ export default {
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);
for (var i = 0; i < keys.length; i++) {
if (!_.has(lt, keys[i])) {
NeedIt.push(keys[i]);
}
});
//todo: make this work with the locale route to get teh batch of keys and store into the lt object
fetch(config.apiUrl + "auth", {
}
fetch(config.apiUrl + "locale/subset", {
method: "post",
mode: "cors",
headers: {
Accept: "application/json, text/plain, */*",
"Content-Type": "application/json"
"Content-Type": "application/json",
Authorization: "Bearer " + getToken()
},
body: JSON.stringify({
login: "",
password: ""
})
body: JSON.stringify(NeedIt)
})
.then(api.status)
.then(api.json)