From edaf1ccb2b57ba2205e0aee9a3a4c9cea7a448aa Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 3 Aug 2026 08:23:26 +0000 Subject: [PATCH] =?UTF-8?q?Valbar=20hash-routing=20f=C3=B6r=20statiska=20f?= =?UTF-8?q?=C3=B6rhandsvisningar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VITE_HASH_ROUTER vid bygget byter till HashRouter så att appen kan köras som en enda statisk HTML-fil utan SPA-rewrites (förhandsvisning/ demo). Standardbygget använder historik-routing precis som förut. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_012EQg3rJsrQ1ZNTvkzmQAtt --- src/App.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c2ef606..900c55c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,7 +2,7 @@ import { Toaster } from "@/components/ui/toaster"; import { Toaster as Sonner } from "@/components/ui/sonner"; import { TooltipProvider } from "@/components/ui/tooltip"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { BrowserRouter, Routes, Route } from "react-router-dom"; +import { BrowserRouter, HashRouter, Routes, Route } from "react-router-dom"; import Index from "./pages/Index"; import NotFound from "./pages/NotFound"; import ResetPassword from "./pages/ResetPassword"; @@ -24,9 +24,13 @@ import { PaymentTestModeBanner } from "@/components/PaymentTestModeBanner"; const queryClient = new QueryClient(); +// Hash-baserad routing för miljöer utan SPA-rewrites (t.ex. förhandsvisning +// på en statisk sida). Standard är vanlig historik-routing. +const Router = import.meta.env.VITE_HASH_ROUTER ? HashRouter : BrowserRouter; + function AppContent() { return ( - + } /> @@ -48,7 +52,7 @@ function AppContent() { {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> - + ); }