mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-03-22 07:41:51 +00:00
Merge pull request #394 from firezone/fix-version-selector
Fix docs version selector
This commit is contained in:
@@ -22,8 +22,18 @@ let populateSelect = function (versions) {
|
||||
|
||||
selects.forEach(select => {
|
||||
select.addEventListener('change', (e) => {
|
||||
let path = e.target.selectedIndex === 0 ? '/' : e.target.value
|
||||
window.location.href = path
|
||||
if (e.target.selectedIndex === 0) {
|
||||
// Remove version in path
|
||||
window.location.href = window.location.origin +
|
||||
window.location.pathname
|
||||
.split('/')
|
||||
.filter(part => !part.match(/\d+\.\d+\.\d+/g))
|
||||
.join('/')
|
||||
} else {
|
||||
// Add version to path
|
||||
window.location.href =
|
||||
window.location.origin + e.target.value + window.location.pathname
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user