Fix: Language navigate replace
This commit is contained in:
parent
66fa95bb33
commit
710dc3c30d
2 changed files with 10 additions and 4 deletions
|
@ -2,13 +2,13 @@ import { Title } from "@solidjs/meta";
|
||||||
import { useNavigate } from "@solidjs/router";
|
import { useNavigate } from "@solidjs/router";
|
||||||
import { HttpStatusCode } from "@solidjs/start";
|
import { HttpStatusCode } from "@solidjs/start";
|
||||||
import Wrapper from "~/components/Wrapper";
|
import Wrapper from "~/components/Wrapper";
|
||||||
import Navbar from "~/components/en/Navbar";
|
import Navbar, { lightMode } from "~/components/en/Navbar";
|
||||||
import "~/styles/overview.scss";
|
import "~/styles/overview.scss";
|
||||||
|
|
||||||
export default function NotFound() {
|
export default function NotFound() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
return (
|
return (
|
||||||
<Wrapper class="overview">
|
<Wrapper class="overview" classList={{ "light-mode": lightMode() }}>
|
||||||
<Title>Not Found</Title>
|
<Title>Not Found</Title>
|
||||||
<HttpStatusCode code={404} />
|
<HttpStatusCode code={404} />
|
||||||
<Navbar />
|
<Navbar />
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
import { Title } from "@solidjs/meta";
|
import { Title } from "@solidjs/meta";
|
||||||
import { useNavigate } from "@solidjs/router";
|
import { useNavigate } from "@solidjs/router";
|
||||||
|
import { HttpStatusCode } from "@solidjs/start";
|
||||||
import { createEffect } from "solid-js";
|
import { createEffect } from "solid-js";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const isGerman = navigator.language.startsWith("de");
|
const isGerman = navigator.language.startsWith("de");
|
||||||
navigate(isGerman ? "/de" : "/en");
|
navigate(isGerman ? "/de" : "/en", { replace: true });
|
||||||
});
|
});
|
||||||
return <Title>Language detection...</Title>;
|
return (
|
||||||
|
<>
|
||||||
|
<Title>Language detection...</Title>
|
||||||
|
<HttpStatusCode code={302} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue