File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,9 +11,27 @@ import { data as starsData } from "../stars.data";
1111export default {
1212 extends : DefaultTheme ,
1313 Layout,
14- enhanceApp ( { app } ) {
14+ enhanceApp ( { app, router } ) {
1515 enhanceAppWithTabs ( app ) ;
1616 initBanner ( ) ;
17+
18+ const onBeforeRouteChange = router . onBeforeRouteChange ;
19+ router . onBeforeRouteChange = async ( to ) => {
20+ if ( typeof window !== "undefined" ) {
21+ const url = new URL ( to , window . location . origin ) ;
22+ if (
23+ url . origin === window . location . origin &&
24+ url . pathname . startsWith ( "/tools/" )
25+ ) {
26+ const toolPath = url . pathname . replace ( / \. h t m l $ / , "" ) ;
27+ window . location . assign (
28+ `https://mise-versions.jdx.dev${ toolPath } ${ url . search } ${ url . hash } ` ,
29+ ) ;
30+ return false ;
31+ }
32+ }
33+ return onBeforeRouteChange ?.( to ) ;
34+ } ;
1735 } ,
1836 setup ( ) {
1937 onMounted ( ( ) => {
You can’t perform that action at this time.
0 commit comments