This commit is contained in:
2018-11-12 23:13:39 +00:00
parent c276d395fb
commit 251cd6dbb6
2 changed files with 70 additions and 11 deletions

View File

@@ -15,13 +15,16 @@ function addNavItem(title, icon, route) {
// Initialize the app
// on change of authentication status
export default function initialize() {
console.log("initialize called");
//clear the nav items either way
store.state.navItems = [];
//clear the locale text cache
lt.ClearCache();
if (store.state.authenticated) {
console.log("initialize about to call fetch");
//fetch the required localized text keys into the cache
lt.Fetch([
lt.SuperFetch([
"Home",
"Service",
"Dispatch",
"Inventory",
@@ -31,8 +34,10 @@ export default function initialize() {
"HelpAboutAyaNova",
"Logout"
])
.then(() => {
debugger;
.then(function() {
console.log(
"initialize back from fetch call, about to use the keys supposedly fetched now"
);
//put nav items into store
//Everyone has a home
addNavItem(lt.Get("Home"), "home", "/");
@@ -87,7 +92,9 @@ export default function initialize() {
addNavItem(lt.Get("Logout"), "sign-out-alt", "/login");
})
.catch(function(error) {
alert("initialize::LT->Prefetch failed: " + error);
// oops, mom don't buy it
console.log(error.message);
// output: 'mom is not happy'
});
}
}