This commit is contained in:
2020-03-25 18:40:03 +00:00
parent 4ffd9a09bc
commit c0cfe4f2d6
2 changed files with 37 additions and 1 deletions

View File

@@ -735,7 +735,7 @@ export default function initialize() {
} }
}) })
.then(() => { .then(() => {
//CACHE TRANSLATION SETTINGS //GET USER OPTIONS
window.$gz.api window.$gz.api
.get("UserOptions/" + window.$gz.store.state.userId) .get("UserOptions/" + window.$gz.store.state.userId)
.then(res => { .then(res => {
@@ -788,6 +788,36 @@ export default function initialize() {
throw error; throw error;
}); });
}) })
.then(() => {
//GET GLOBAL SETTINGS
window.$gz.api
.get("GlobalBizSettings/client")
.then(res => {
if (res.error != undefined) {
//In a form this would trigger a bunch of validation or error display code but for here and now:
//convert error to human readable string for display and popup a notification to user
var msg = window.$gz.api.apiErrorToHumanString(res.error);
window.$gz.store.commit(
"logItem",
"Initialize::() fetch GlobalBizSettings/client -> error" + msg
);
window.$gz.eventBus.$emit("notify-error", msg);
} else {
//Check if overrides and use them here
//or else use browser defaults
window.$gz.store.commit("setGlobalSettings", res.data);
resolve();
}
})
.catch(function handleFetchClientGlobalSettingsError(error) {
window.$gz.store.commit(
"logItem",
"Initialize::() fetch GlobalBizSettings/client -> error" + error
);
throw error;
});
})
.catch(function handleIntializeError(error) { .catch(function handleIntializeError(error) {
window.$gz.store.commit( window.$gz.store.commit(
"logItem", "logItem",

View File

@@ -28,6 +28,7 @@ export default new Vuex.Store({
currencyName: "USD", currencyName: "USD",
hour12: true hour12: true
}, },
globalSettings: {},
navItems: [], navItems: [],
logArray: [], logArray: [],
formSettings: {}, //this is the settings on forms that survive a refresh like grid number of items to show etc formSettings: {}, //this is the settings on forms that survive a refresh like grid number of items to show etc
@@ -64,6 +65,7 @@ export default new Vuex.Store({
state.locale.timeZoneOverride = "America/New_York"; state.locale.timeZoneOverride = "America/New_York";
state.locale.currencyName = "USD"; state.locale.currencyName = "USD";
state.locale.hour12 = true; state.locale.hour12 = true;
state.globalSettings={};
}, },
addNavItem(state, data) { addNavItem(state, data) {
state.navItems.push(data); state.navItems.push(data);
@@ -83,6 +85,10 @@ export default new Vuex.Store({
state.locale.hour12 = data.hour12; state.locale.hour12 = data.hour12;
state.locale.timeZoneOverride = data.timeZoneOverride; state.locale.timeZoneOverride = data.timeZoneOverride;
}, },
setGlobalSettings(state, data) {
// mutate state
state.globalSettings = data;
},
setEnum(state, data) { setEnum(state, data) {
state.enums[data.enumKey] = data.items; //{enumKey:"AuthorizationRoles",items:[{0:"no role"},{1:"Limited role"}]} state.enums[data.enumKey] = data.items; //{enumKey:"AuthorizationRoles",items:[{0:"no role"},{1:"Limited role"}]}
}, },