Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mejores mensajes de error en el signup #38

Merged
merged 7 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll": "explicit"
}
},
"standard.enable": false
}
873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.1.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.5.1.cjs
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"prettier-plugin-tailwindcss": "^0.5.10",
"prisma": "^5.7.1",
"ts-node": "^10.9.1",
"vitest": "^1.1.0",
"yarn": "^1.22.21"
}
"vitest": "^1.1.0"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion src/components/signup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sendSignUp } from "./client";
import { useState } from "react";
import { sendSignUp } from "./client";
import { Alert, SuccessAlert } from "../alert";
import { Button } from "../button";
import { PasswordInput } from "../password";
Expand Down
7 changes: 5 additions & 2 deletions src/pages/api/user/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function createUserHandler(
if (password.length < 8) {
return res
.status(400)
.json({ message: "password length should be more than 8 characters" });
.json({ message: "La contraseña debe tener al menos 8 caracteres" });
}
try {
const user = await prisma.userAuth.create({
Expand All @@ -42,7 +42,10 @@ async function createUserHandler(
} catch (e) {
if (e instanceof Prisma.PrismaClientKnownRequestError) {
if (e.code === "P2002") {
return res.status(400).json({ message: e.message });
Janque marked this conversation as resolved.
Show resolved Hide resolved
// Docs: https://www.prisma.io/docs/orm/reference/error-reference#p2002
return res
.status(400)
.json({ message: "Ya existe una cuenta con ese email." });
}
return res.status(400).json({ message: e.message });
}
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"incremental": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
"@/*": ["./src/*"],
},
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"next.config.mjs",
"postcss.config.js"
"postcss.config.js",
],
"exclude": ["node_modules"]
"exclude": ["node_modules"],
}
13,723 changes: 8,146 additions & 5,577 deletions yarn.lock

Large diffs are not rendered by default.

Loading