forked from pdsls.dev/pdsls
this repo has no description

navigate when replacing handle to did

Changed files
+3 -2
src
+3 -2
src/layout.tsx
··· 1 1 import { createEffect, ErrorBoundary, Show, Suspense } from "solid-js"; 2 - import { A, RouteSectionProps, useLocation, useParams } from "@solidjs/router"; 2 + import { A, RouteSectionProps, useLocation, useNavigate, useParams } from "@solidjs/router"; 3 3 import { loginState } from "./components/login.jsx"; 4 4 import { RecordEditor } from "./components/create.jsx"; 5 5 import Tooltip from "./components/tooltip.jsx"; ··· 15 15 const Layout = (props: RouteSectionProps<unknown>) => { 16 16 const params = useParams(); 17 17 const location = useLocation(); 18 + const navigate = useNavigate(); 18 19 if (location.search.includes("kawaii=true")) localStorage.kawaii = "true"; 19 20 20 21 createEffect(async () => { 21 22 if (params.repo && !params.repo.startsWith("did:")) { 22 23 const did = await resolveHandle(params.repo as Handle); 23 - window.location.replace(location.pathname.replace(params.repo, did)); 24 + navigate(location.pathname.replace(params.repo, did)); 24 25 } 25 26 }); 26 27