Skip to content

Commit

Permalink
Remember previous active tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ninokhonelia committed Jan 24, 2023
1 parent c9091cf commit 00ccccf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion resources/js/mixins/HasTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export default {

const tabs = this.tabs = this.setTabs();
const routeTabs = parseLocationHash();
const currentTabSlug = routeTabs[this.getTabsReference()];
var currentTabSlug = routeTabs[this.getTabsReference()];

if(sessionStorage.hasOwnProperty(this.getTabsReference())){
currentTabSlug = sessionStorage.getItem(this.getTabsReference());
}

if (tabs[currentTabSlug]) {
this.handleTabClick(tabs[currentTabSlug])
Expand Down Expand Up @@ -216,6 +220,7 @@ export default {
setLocationHash() {
const routeTabs = parseLocationHash()
routeTabs[this.getTabsReference()] = this.selectedTab.slug;
sessionStorage.setItem(this.getTabsReference(), this.selectedTab.slug)
updateLocationHash(routeTabs)
},

Expand Down

0 comments on commit 00ccccf

Please sign in to comment.