added loading and new npm

This commit is contained in:
2025-11-12 16:35:22 -06:00
parent c04fb22d07
commit b581b6d22e
5 changed files with 992 additions and 384 deletions
-1
View File
@@ -1 +0,0 @@
NEXT_PUBLIC_API_URL=
+958 -370
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -11,22 +11,22 @@
"dependencies": {
"@ericblade/quagga2": "^1.8.4",
"@zxing/library": "^0.21.3",
"axios": "^1.13.1",
"axios": "^1.13.2",
"js-cookie": "^3.0.5",
"next": "15.5.6",
"react": "19.1.0",
"react-dom": "19.1.0",
"next": "16.0.2",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-hot-toast": "^2.6.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20",
"@types/node": "^24",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.5.6",
"sass": "^1.93.2",
"eslint-config-next": "16.0.2",
"sass": "^1.94.0",
"typescript": "^5"
}
}
+8 -1
View File
@@ -11,12 +11,15 @@ import toast from "react-hot-toast";
export default function Login() {
const [nombre, setNombre] = useState("");
const [password, setPassword] = useState("");
const [loading, setLoading] = useState(false);
const router = useRouter();
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
setLoading(true);
try {
const response = await axios.post(
`${process.env.NEXT_PUBLIC_API_URL}/auth/login`,
@@ -43,6 +46,8 @@ export default function Login() {
} else {
toast.error("Ocurrió un error inesperado");
}
} finally {
setLoading(false);
}
};
@@ -71,7 +76,9 @@ export default function Login() {
required
/>
</div>
<button type="submit">Iniciar sesión</button>
<button type="submit" disabled={loading}>
{loading ? "Buscando..." : "Iniciar sesión"}
</button>
{/* <Link href={"/forgotPassword"}>Olvidaste Contraseña?</Link> */}
{/* <Link href={"/crearCuenta"}>Crear Cuenta</Link> */}
+19 -5
View File
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -11,7 +15,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
@@ -19,9 +23,19 @@
}
],
"paths": {
"@/*": ["./src/*"]
"@/*": [
"./src/*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}