Skip to content

Commit

Permalink
docs(api): fix api nav toggle url path check so it works in production
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Mulfinger committed Jul 27, 2018
1 parent 93a7351 commit 90db4a0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/src/js/nav-toggle.js
Expand Up @@ -5,8 +5,9 @@ Vue.component("nav-toggle", {
this.list = document.getElementById("list" + this.index);
this.toggle = false;

const partialPath = window.location.pathname.split("/")[2];
if (partialPath !== "" && this.packageName.indexOf(partialPath) > -1) {
const match = window.location.pathname.match(/\/api\/([^\/]+)\//);
const partialPath = match ? match[1] : null;
if (partialPath && this.packageName.indexOf(partialPath) > -1) {
this.show();
}

Expand Down Expand Up @@ -36,5 +37,5 @@ Vue.component("nav-toggle", {
}
this.toggle = true;
}
},
});
}
});

0 comments on commit 90db4a0

Please sign in to comment.