[M] Move pushState to navigation.ts as well
This commit is contained in:
@@ -251,26 +251,6 @@ export default class App extends Vue
|
|||||||
this.loading = message;
|
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
|
* Sign out
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,18 @@ export default class Navigation extends Vue
|
|||||||
|
|
||||||
// Call custom event
|
// Call custom event
|
||||||
this.$emit('navigation:select', this.activeIndex);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user