diff --git a/app/(private)/Inscritos/Inscripciones.tsx b/app/(private)/Inscritos/Inscripciones.tsx new file mode 100644 index 0000000..02924ce --- /dev/null +++ b/app/(private)/Inscritos/Inscripciones.tsx @@ -0,0 +1,79 @@ +"use client" +import { envConfig } from "@/app/lib/config"; +import axios from "axios"; +import { useEffect, useState } from "react"; + +interface Periodo{ + semestre:string, +} + +export default function Inscripciones() { + const [periodo,setPeriodo]= useState([]) + + useEffect(()=>{ + const getPeriodo = async()=>{ + const response = await axios.get(`${envConfig.apiUrl}/periodo`) + setPeriodo(response.data) + } + getPeriodo() + },[]) + + return ( +
+

INSCRITOS

+ +
+ +
+ + +
+
+ +
+ + + + + + + + + + +
CarreraGeneroProfesoresTotal
+
+ +
+ + + + + + + + + + + + + + + + + + + +
Impresione B/NImpresiones ColorPlotteoEscanerTotal
5,00010,00010,00020,00045,000
+
+
+ ); +} +//IO diff --git a/app/(private)/Inscritos/page.tsx b/app/(private)/Inscritos/page.tsx index 517f288..1181c94 100644 --- a/app/(private)/Inscritos/page.tsx +++ b/app/(private)/Inscritos/page.tsx @@ -1,3 +1,5 @@ +import Inscripciones from "./Inscripciones"; + export default async function Page(props: { searchParams?: Promise<{ period: string; @@ -6,65 +8,6 @@ export default async function Page(props: { const params = await props.searchParams; const period = params?.period ? params.period : null; - return ( -
-

INSCRITOS

- -
- -
- - -
-
- -
- - - - - - - - - - -
CarreraGeneroProfesoresTotal
-
- -
- - - - - - - - - - - - - - - - - - - -
Impresione B/NImpresiones ColorPlotteoEscanerTotal
5,00010,00010,00020,00045,000
-
-
- ); + return ; } //IO diff --git a/app/Components/auth/ChangePassword/changePassword.tsx b/app/Components/auth/ChangePassword/changePassword.tsx index e59abfc..48b7b0b 100644 --- a/app/Components/auth/ChangePassword/changePassword.tsx +++ b/app/Components/auth/ChangePassword/changePassword.tsx @@ -1,17 +1,24 @@ "use client"; import apiClient from "@/app/lib/apiClient"; import { useState } from "react"; +import toast from "react-hot-toast"; export default function ChangePassword() { - const [pass, setPass] = useState(""); - const [newPass, setNewPass] = useState(""); + const [password, setPass] = useState(""); + const [newPassword, setNewPass] = useState(""); const [confirmNewPass, setconfirmNewPass] = useState(""); const handleChangePass = async (e: React.FormEvent) => { - e.preventDefault; - const data = { pass, newPass, confirmNewPass }; + e.preventDefault(); + const data = { password, newPassword }; - await apiClient.post("/user/create", data); + try{ + const response = await apiClient.post("/user/changePassword", data); + toast.success( `${response.data.message}`) + }catch{ + toast.error( `No es la contraseña actual`) + } + }; return ( @@ -21,7 +28,8 @@ export default function ChangePassword() { { setPass(e.target.value); }} @@ -33,7 +41,8 @@ export default function ChangePassword() { { setNewPass(e.target.value); }} @@ -46,6 +55,7 @@ export default function ChangePassword() { { setconfirmNewPass(e.target.value); }} @@ -57,7 +67,6 @@ export default function ChangePassword() { @@ -65,7 +74,6 @@ export default function ChangePassword() { @@ -74,3 +82,4 @@ export default function ChangePassword() { ); } +//IO \ No newline at end of file diff --git a/app/lib/apiClient.ts b/app/lib/apiClient.ts index 41d3a64..648bbe8 100644 --- a/app/lib/apiClient.ts +++ b/app/lib/apiClient.ts @@ -37,18 +37,9 @@ apiClient.interceptors.response.use( Cookies.remove("token"); Cookies.remove("user"); - if ( - typeof window !== "undefined" && - !window.location.pathname.includes("/") - ) { - window.location.href = "/"; - } } if (status === 403) { - if (typeof window !== "undefined") { - window.location.href = "/Impresiones"; - } } } return Promise.reject(error);