Commit f6928d0a authored by 우지원's avatar 우지원
Browse files

회원가입 server연결중

parent 2a466264
...@@ -55,7 +55,7 @@ function SingUp() { ...@@ -55,7 +55,7 @@ function SingUp() {
// setUser(INIT_USER) // setUser(INIT_USER)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
setError('에러발생') setError('오류가 발생했습니다!')
} }
} }
...@@ -128,7 +128,6 @@ function SingUp() { ...@@ -128,7 +128,6 @@ function SingUp() {
</Form.Control.Feedback> </Form.Control.Feedback>
</Form.Group> </Form.Group>
{/* <Link to="./login"> */} {/* <Link to="./login"> */}
<Button <Button
disabled={disabled} disabled={disabled}
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"dev" : "nodemon server/server.js", "dev" : "nodemon server/server.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
......
import User from "../models/User.js" import User from "../models/User.js"
import isLength from 'validator/lib/isLength.js' import isLength from 'validator/lib/isLength.js'
import isEmail from 'validator/lib/isEmail.js' //import isEmail from 'validator/lib/isEmail.js'
//꼭 js붙여주기!! //꼭 js붙여주기!!
//sign validation해야됨 //sign validation해야됨
...@@ -11,10 +11,9 @@ const signup = async (req, res) => { ...@@ -11,10 +11,9 @@ const signup = async (req, res) => {
console.log(username, nickname, email, password) console.log(username, nickname, email, password)
try { try {
if (!isLength(username, { min: 3, max: 10 })) { if (!isLength(username, { min: 3, max: 10 })) {
//이범위를 벗어나면 error발생 //이범위를 벗어나면 error발생
return res.status(422).send('Name must be 3-10 characters') return res.status(422).json({message: 'Name must be 3-10 characters'})
//422 : 형식이 잘못되었다는 error발생 //422 : 형식이 잘못되었다는 error발생
} }
else if (!isLength(nickname, { min: 3, max: 10 })) { else if (!isLength(nickname, { min: 3, max: 10 })) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment