named anonymous functions

This commit is contained in:
2019-04-18 19:51:21 +00:00
parent 7770b8bad1
commit 8cdae969fb
13 changed files with 43 additions and 39 deletions

View File

@@ -17,7 +17,7 @@ export default {
.then(() => {
return Promise.resolve(true);
}) //succeeded, nothing to return
.catch(function(error) {
.catch(function handleAuthError(error) {
processLogout();
return Promise.reject(error);
});

View File

@@ -233,14 +233,14 @@ export default {
//
get(route) {
var that = this;
return new Promise(function(resolve, reject) {
return new Promise(function getDataFromServer(resolve, reject) {
fetch(that.APIUrl(route), that.fetchGetOptions())
.then(that.status)
.then(that.json)
.then(response => {
resolve(response);
})
.catch(function(error) {
.catch(function handleGetError(error) {
//fundamental error, can't proceed with this call
handleError("GET", error, route, reject);
});
@@ -251,7 +251,7 @@ export default {
//
upsert(route, data) {
var that = this;
return new Promise(function(resolve, reject) {
return new Promise(function upsertDataToServer(resolve, reject) {
//determine if this is a new or existing record
var fetchOptions = undefined;
if (data.concurrencyToken) {
@@ -268,7 +268,7 @@ export default {
//and let the caller deal with it appropriately
resolve(response);
})
.catch(function(error) {
.catch(function handleUpsertError(error) {
handleError("UPSERT", error, route, reject);
});
});

View File

@@ -84,6 +84,10 @@ export default {
} else {
alert("STUB gzmenu::handleClick - menu item clicked: " + menuitem.key);
}
//Logout
// auth.logout();
// this.$router.replace({ name: "login" });
}
}
//new functions above here

View File

@@ -20,7 +20,7 @@ export default function initialize() {
//Fetch the core localized text keys that will always be required by user
locale
.fetch(locale.coreKeys)
.then(function() {
.then(function putFetchedNavItemsInStore() {
//put nav items into store
//Everyone has a home
addNavItem(locale.get("Home"), "home", "/");
@@ -74,7 +74,7 @@ export default function initialize() {
addNavItem(locale.get("HelpAboutAyaNova"), "info-circle", "/about");
addNavItem(locale.get("Logout"), "sign-out-alt", "/login");
})
.catch(function(error) {
.catch(function handleIntializeError(error) {
store.commit("logItem", "Initialize::() ltfetch -> error" + error);
throw error;
});
@@ -110,7 +110,7 @@ export default function initialize() {
locale.timeZoneOffset = res.data.timeZoneOffset;
}
})
.catch(function(error) {
.catch(function handleFetchUserOptionsError(error) {
store.commit(
"logItem",
"Initialize::() fetch useroptions -> error" + error

View File

@@ -12,7 +12,7 @@ export default {
return store.state.localeText[key];
},
fetch(keys) {
return new Promise(function(resolve) {
return new Promise(function fetchLocaleKeysFromServer(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
@@ -33,7 +33,7 @@ export default {
.then(apiUtil.status)
.then(apiUtil.json)
.then(response => {
_.forEach(response.data, function(item) {
_.forEach(response.data, function commitFetchedLTItemToStore(item) {
store.commit("addLocaleText", item);
});