From f6bf56dc5e1cdcd266d7010cd5ccc6e4c59f36f7 Mon Sep 17 00:00:00 2001 From: samuop <129475377+samuop@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:03:29 -0300 Subject: [PATCH] hotfix --- FrontAdmin/src/API/Montos.ts | 2 +- FrontAdmin/src/API/Sysacad.ts | 4 ++-- FrontAdmin/src/Context.tsx | 5 ++++- FrontAdmin/src/components/Pages/SysAdmin/SysAdmin.tsx | 10 ++++++++++ .../Pages/Sysacad/ExcelSysacad/CargaExcel.tsx | 2 +- FrontAdmin/src/routes.tsx | 3 ++- 6 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 FrontAdmin/src/components/Pages/SysAdmin/SysAdmin.tsx diff --git a/FrontAdmin/src/API/Montos.ts b/FrontAdmin/src/API/Montos.ts index d67cf4b..0cba830 100644 --- a/FrontAdmin/src/API/Montos.ts +++ b/FrontAdmin/src/API/Montos.ts @@ -63,7 +63,7 @@ export const loadPDF = async (id :string,file: File) => { const formData = new FormData(); formData.append('archivo_pdf', file); - const response = await fetch(`${URL}/compromisos/${id}/`, { + const response = await fetch(`http://localhost:8000/api/compromisos/${id}/`, { method: 'PATCH', headers: { Authorization: `Bearer ${token}`, diff --git a/FrontAdmin/src/API/Sysacad.ts b/FrontAdmin/src/API/Sysacad.ts index 92eb43f..bd3ce42 100644 --- a/FrontAdmin/src/API/Sysacad.ts +++ b/FrontAdmin/src/API/Sysacad.ts @@ -8,7 +8,7 @@ export const FetchExcel = async (excelFile: File) => { formData.append('file', excelFile); const response = await fetch( - `http://localhost:8000/api/excels/`, + `http://localhost:8000/api/excels/sysacad/`, { method: 'POST', headers: { @@ -37,7 +37,7 @@ export const FetchHistorialExcel = async () => { const token = Cookies.get('tokennn'); const response = await fetch( - 'http://localhost:8000/api/excels/', + 'http://localhost:8000/api/excels/sysacad/', { method: 'GET', headers: { diff --git a/FrontAdmin/src/Context.tsx b/FrontAdmin/src/Context.tsx index c781e01..4f4a377 100644 --- a/FrontAdmin/src/Context.tsx +++ b/FrontAdmin/src/Context.tsx @@ -13,7 +13,10 @@ interface AuthContextType { const AuthContext = createContext(undefined); const AuthProvider = ({ children }: { children: ReactNode }) => { - const [rolUser, setRolUser] = useState(JSON.parse(localStorage.getItem('userRol') || '[]')); + const [rolUser, setRolUser] = useState(() => { + const storedUserRol = localStorage.getItem('userRol'); + return storedUserRol ? JSON.parse(storedUserRol) : []; + }); const [isAuthenticated, setIsAuthenticated] = useState( (!Cookies.get('tokennn') ) ? false : true ); diff --git a/FrontAdmin/src/components/Pages/SysAdmin/SysAdmin.tsx b/FrontAdmin/src/components/Pages/SysAdmin/SysAdmin.tsx new file mode 100644 index 0000000..1e95bc8 --- /dev/null +++ b/FrontAdmin/src/components/Pages/SysAdmin/SysAdmin.tsx @@ -0,0 +1,10 @@ +import { Grid, Text, Stack } from '@chakra-ui/react'; +import { Tabs, TabList, TabPanels, Tab, TabPanel, Box } from '@chakra-ui/react' + +function Sysadmin() { + return ( + <> + ); +} + +export default Sysadmin; \ No newline at end of file diff --git a/FrontAdmin/src/components/Pages/Sysacad/ExcelSysacad/CargaExcel.tsx b/FrontAdmin/src/components/Pages/Sysacad/ExcelSysacad/CargaExcel.tsx index 92bf47d..8dab266 100644 --- a/FrontAdmin/src/components/Pages/Sysacad/ExcelSysacad/CargaExcel.tsx +++ b/FrontAdmin/src/components/Pages/Sysacad/ExcelSysacad/CargaExcel.tsx @@ -28,7 +28,7 @@ function CargaExcel() { setIsLoading(true); const token = Cookies.get('tokennn'); const response = await fetch( - `http://localhost:8000/api/excels/`, + `http://localhost:8000/api/excels/sysacad/`, { method: 'POST', headers: { diff --git a/FrontAdmin/src/routes.tsx b/FrontAdmin/src/routes.tsx index ff64f75..e6960a7 100644 --- a/FrontAdmin/src/routes.tsx +++ b/FrontAdmin/src/routes.tsx @@ -29,6 +29,7 @@ import Select from './components/Pages/Estadisticas/SubPages/Cuotas/Select'; import Listado from './components/Pages/Estadisticas/SubPages/Cuotas/Listado'; import path from 'path'; import EstadoCuenta from './components/Pages-Alumnos/EstadoCuenta/EstadoCuenta'; +import Sysadmin from './components/Pages/SysAdmin/SysAdmin'; const routes = [ { @@ -81,7 +82,7 @@ const routes = [ { path: 'sysadmin', title: 'SysAdmin', - element: , + element: , icon: iconSysAdmin, rol: 'admin', },