This commit is contained in:
2019-04-26 21:02:04 +00:00
parent 1565c4c94b
commit aa3751be35
6 changed files with 67 additions and 209 deletions

View File

@@ -16,11 +16,17 @@ function addNavItem(title, icon, route) {
// Initialize the app
// on change of authentication status
export default function initialize() {
/* eslint-disable-next-line */
console.log("STEP 3 - INITIALIZE TOP");
if (store.state.authenticated) {
/* eslint-disable-next-line */
console.log("STEP 4 - INITIALIZE FETCHING LOCALE KEYS");
//Fetch the core localized text keys that will always be required by user
locale
.fetch(locale.coreKeys)
.then(function putFetchedNavItemsInStore() {
/* eslint-disable-next-line */
console.log("STEP 5 - DONE FETCHING LOCALE KEYS CREATING NAV ITEMS");
//put nav items into store
//Everyone has a home
addNavItem(locale.get("Home"), "home", "/");
@@ -80,6 +86,8 @@ export default function initialize() {
throw error;
});
/* eslint-disable-next-line */
console.log("STEP 6 - INIT DONE WITH NAV, NOW FETCHING USEROPTIONS SETTINGS");
//CACHE LOCALE SETTINGS
api
.get("UserOptions/" + store.state.userId)
@@ -98,17 +106,19 @@ export default function initialize() {
if (res.data.timeZoneOffset != localOffset) {
//todo: timezone doesn't match, offer to fix it
alert(
"Time zone offset for this account is set to " +
res.data.timeZoneOffset +
" which doesn't match the local timezone offset of " +
localOffset +
"."
);
// alert(
// "Time zone offset for this account is set to " +
// res.data.timeZoneOffset +
// " which doesn't match the local timezone offset of " +
// localOffset +
// "."
// );
}
//Store offset in locale data
locale.timeZoneOffset = res.data.timeZoneOffset;
/* eslint-disable-next-line */
console.log("STEP 7 - DONE FETCHING LOCALE SETTINGS");
}
})
.catch(function handleFetchUserOptionsError(error) {