[M] Move pushState to navigation.ts as well

This commit is contained in:
Hykilpikonna
2019-10-14 16:42:09 -04:00
parent 4efac6023f
commit cdaa2679d1
2 changed files with 12 additions and 20 deletions
-20
View File
@@ -251,26 +251,6 @@ export default class App extends Vue
this.loading = message;
}
/**
* This is called when a navigation tab is clicked
*
* @param tab Tab name
*/
public onNavigate(tab: string)
{
// Debug output TODO: Remove this
console.log(`onNavigate: Previous: ${this.selectedTab}, New: ${tab}`);
// Update selected tab
this.selectedTab = tab;
// Check url
let url = `/${tab}`;
// Push history state
window.history.pushState({lastTab: this.selectedTab}, '', url);
}
/**
* Sign out
*/
+12
View File
@@ -50,6 +50,18 @@ export default class Navigation extends Vue
// Call custom event
this.$emit('navigation:select', this.activeIndex);
// Debug output TODO: Remove this
console.log(`onNavigate: Previous: ${this.activeIndex}, New: ${index}`);
// Update selected tab
this.activeIndex = index;
// Check url
let url = `/${index}`;
// Push history state
window.history.pushState({lastTab: index}, '', url);
}
/**