Refactor base URL access to use hook in HomePage

Replaced direct usage of getBaseUrl with the useBaseUrl hook in HomePage.tsx for improved React integration. Updated app constants to clarify usage and added a newline for readability.
This commit is contained in:
Ludy87 2025-09-24 20:01:56 +02:00
parent 38d10e7c06
commit dc0b812214
No known key found for this signature in database
GPG Key ID: 92696155E0220F94
2 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ export const DEFAULT_BASE_URL = 'https://stirling.com';
export const getBaseUrlFromConfig = (config?: AppConfig | null): string =>
config?.baseUrl || DEFAULT_BASE_URL;
// Hook to access the base URL within React components
export const useBaseUrl = (): string => {
const { config } = useAppConfig();

View File

@ -3,7 +3,7 @@ import { useToolWorkflow } from "../contexts/ToolWorkflowContext";
import { Group } from "@mantine/core";
import { useSidebarContext } from "../contexts/SidebarContext";
import { useDocumentMeta } from "../hooks/useDocumentMeta";
import { getBaseUrl } from "../constants/app";
import { useBaseUrl } from "../constants/app";
import ToolPanel from "../components/tools/ToolPanel";
import Workbench from "../components/layout/Workbench";
@ -22,7 +22,7 @@ export default function HomePage() {
const { selectedTool, selectedToolKey } = useToolWorkflow();
const baseUrl = getBaseUrl();
const baseUrl = useBaseUrl();
// Update document meta when tool changes
useDocumentMeta({