This commit is contained in:
@@ -50,17 +50,14 @@ var ayTranslationKeyCache = {};
|
||||
// GET TRANSLATIONS FROM API SERVER
|
||||
//
|
||||
async function ayGetTranslations(keys) {
|
||||
if (!keys || keys.length == 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
let r = await fetch(route, {
|
||||
method: "get",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token
|
||||
}
|
||||
let transData = await ayPostToAPI("translation/subset", keys);
|
||||
transData.data.forEach(function storeFetchedTranslationItemsInCache(item) {
|
||||
ayTranslationKeyCache[item.key] = item.value;
|
||||
});
|
||||
return await r.json();
|
||||
} catch (error) {
|
||||
//fundamental error, can't proceed with this call
|
||||
// handleError("GET", error, route);
|
||||
@@ -74,7 +71,7 @@ async function ayGetTranslations(keys) {
|
||||
//
|
||||
async function ayGetFromAPI(route, token) {
|
||||
token = token || AYMETA.ayClientMetaData.Authorization;
|
||||
if(route && !route.startsWith("http")){
|
||||
if (route && !route.startsWith("http")) {
|
||||
route = AYMETA.ayServerMetaData.ayApiUrl + route;
|
||||
}
|
||||
try {
|
||||
@@ -101,7 +98,7 @@ async function ayGetFromAPI(route, token) {
|
||||
//
|
||||
async function ayPostToAPI(route, data, token) {
|
||||
token = token || AYMETA.ayClientMetaData.Authorization;
|
||||
if(route && !route.startsWith("http")){
|
||||
if (route && !route.startsWith("http")) {
|
||||
route = AYMETA.ayServerMetaData.ayApiUrl + route;
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user