feat: demo page realisation
This commit is contained in:
26
src/pages/Route/DemoPage/index.tsx
Normal file
26
src/pages/Route/DemoPage/index.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { apiStore } from "../../../client/src/api/ApiStore/store";
|
||||
import App from "../../../client/src/App";
|
||||
import "../../../client/src/index.css";
|
||||
import "../../../client/src/App.css";
|
||||
|
||||
export const DemoPage = () => {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
|
||||
// Устанавливаем routeId синхронно при рендере,
|
||||
// чтобы App уже имел его при монтировании
|
||||
if (id && apiStore.routeId !== id) {
|
||||
apiStore.setRouteId(id);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
apiStore.stopPositionSimulation();
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (!id) return null;
|
||||
|
||||
return <App />;
|
||||
};
|
||||
Reference in New Issue
Block a user