Skip to content

Commit

Permalink
Maybe fix appUrlOpen
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman authored and TonyGiorgio committed Jun 10, 2024
1 parent 850e347 commit 65fe31c
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,6 @@ if (Capacitor.isNativePlatform()) {
function ChildrenOrError(props: { children: JSX.Element }) {
const [state] = useMegaStore();

return (
<Switch>
<Match when={state.setup_error}>
<SetupErrorDisplay
initialError={state.setup_error!}
password={state.password}
/>
</Match>
<Match when={true}>{props.children}</Match>
</Switch>
);
}

export function Router() {
// listeners for native navigation handling
// Check if the platform is Android to handle back
onMount(async () => {
Expand Down Expand Up @@ -120,10 +106,15 @@ export function Router() {
const path = url.pathname;
const urlParams = new URLSearchParams(url.search);

console.log(
`Navigating to ${path}?${urlParams.toString()}`
);
navigate(`${path}?${urlParams.toString()}`);
if (urlParams.size) {
console.log(
`Navigating to ${path}?${urlParams.toString()}`
);
navigate(`${path}?${urlParams.toString()}`);
} else {
console.log(`Navigating to ${path}`);
navigate(path);
}
}
);

Expand All @@ -133,6 +124,21 @@ export function Router() {
});
}
});

return (
<Switch>
<Match when={state.setup_error}>
<SetupErrorDisplay
initialError={state.setup_error!}
password={state.password}
/>
</Match>
<Match when={true}>{props.children}</Match>
</Switch>
);
}

export function Router() {
return (
<SolidRouter
root={(props) => (
Expand Down

0 comments on commit 65fe31c

Please sign in to comment.