This commit is contained in:
parent
6f7b821c8b
commit
3a5b0bdcbc
162 changed files with 15801 additions and 224 deletions
52
FRONT/DEV/index.tsx
Normal file
52
FRONT/DEV/index.tsx
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { HashRouter } from 'react-router-dom';
|
||||
import { useIpStore } from './src/store';
|
||||
import { useEffect } from 'react';
|
||||
import {useCheckAdmin} from './src/utils/checkAdmin.ts'
|
||||
|
||||
import {
|
||||
ModalProvider,
|
||||
useModalContext,
|
||||
ThemeProvider
|
||||
} from './src/store';
|
||||
|
||||
import WindowComponent from './src/components/modalwindows/modalWindow.tsx';
|
||||
import Router from './src/router.tsx';
|
||||
|
||||
const MainComponent = () => {
|
||||
|
||||
const checkAdmin = useCheckAdmin()
|
||||
const {ipAddress} = useIpStore()
|
||||
|
||||
useEffect(() => {
|
||||
const checkAdminStatus = async () => {
|
||||
await checkAdmin()
|
||||
}
|
||||
checkAdminStatus()
|
||||
}, [ipAddress])
|
||||
|
||||
|
||||
const { isOpen, modalType, modalData } = useModalContext();
|
||||
return (
|
||||
<>
|
||||
<WindowComponent isOpen={isOpen} type={modalType} data={modalData} />
|
||||
<Router />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const container = document.getElementById('root');
|
||||
if (!container) {
|
||||
throw new Error('Root element with id "root" not found');
|
||||
}
|
||||
const root = createRoot(container);
|
||||
root.render(
|
||||
<ThemeProvider>
|
||||
<HashRouter>
|
||||
<ModalProvider>
|
||||
<MainComponent />
|
||||
</ModalProvider>
|
||||
</HashRouter>
|
||||
</ThemeProvider>
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue