Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
students
survey
Commits
b3f9e9f7
Commit
b3f9e9f7
authored
Jul 04, 2022
by
Lee SeoYeon
Browse files
0704
parent
295f91db
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/auth/Login.tsx
View file @
b3f9e9f7
import
React
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
// type LoginProps = {
// type LoginProps = {
// };
// };
export
const
Login
=
()
=>
(
export
const
Login
=
()
=>
{
<
div
className
=
"flex justify-center mt-3"
>
// interface IUSER {
<
div
className
=
"flex flex-col space-y-4 mt-5 text-xl font-bold"
>
// email: string;
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
// password: string;
이메일
// }
</
label
>
<
input
// const [error, setError] = useState("");
className
=
"shadow appearance-none border rounded py-2 px-3 text-gray-70"
// const [disabled, setDisabled] = useState(false);
id
=
"email"
// const [success, setSuccess] = useState(false);
type
=
"email"
// const navigate = useNavigate();
placeholder
=
"이메일을 입력하세요"
/>
// function handleChange(event: type) {}
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
// function handleSubmit(params: type) {}
비밀번호
</
label
>
// if (success) {
<
input
// alert("회원가입 되었습니다");
className
=
"shadow appearance-none border rounded py-2 px-3 text-gray-70"
// navigate(`../`);
id
=
"username"
// }
type
=
"password"
placeholder
=
"비밀번호를 입력하세요"
return
(
/>
<
div
className
=
"flex justify-center mt-3"
>
<
div
className
=
"text-center"
>
<
div
className
=
"flex flex-col space-y-4 mt-5 text-xl font-bold"
>
<
button
className
=
"bg-themeColor text-white border rounded w-100 py-2 px-3 mt-3"
>
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
로그인
이메일
</
button
>
</
label
>
<
input
className
=
"shadow appearance-none border rounded py-2 px-3 text-gray-70"
id
=
"email"
type
=
"email"
placeholder
=
"이메일을 입력하세요"
/>
<
label
className
=
"block text-gray-700 text-sm font-bold mb-2 mt-3"
>
비밀번호
</
label
>
<
input
className
=
"shadow appearance-none border rounded py-2 px-3 text-gray-70"
id
=
"username"
type
=
"password"
placeholder
=
"비밀번호를 입력하세요"
/>
<
div
className
=
"text-center"
>
<
button
className
=
"bg-themeColor text-white border rounded w-100 py-2 px-3 mt-3"
>
로그인
</
button
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
);
)
;
}
;
frontend/src/auth/SignUp.tsx
View file @
b3f9e9f7
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
//
import axios from "axios";
import
axios
from
"
axios
"
;
type
SignUpProps
=
{};
type
SignUpProps
=
{};
export
const
SignUp
=
({}:
SignUpProps
)
=>
{
export
const
SignUp
=
({}:
SignUpProps
)
=>
{
const
USER
=
{
interface
IUSER
{
name
:
""
,
name
:
string
;
email
:
""
,
email
:
string
;
password
:
""
,
password
:
string
;
password2
:
""
,
password2
:
string
;
};
}
// interface USER {
// name: "";
const
[
user
,
setUser
]
=
useState
<
IUSER
>
({
// email: "";
name
:
"
user
"
,
// password: "";
email
:
"
user1234@naver.com
"
,
// password2: "";
password
:
"
1234
"
,
// }
password2
:
"
1234
"
,
});
const
[
user
,
setUser
]
=
useState
(
USER
);
// const [user, setUser] = useState<USER>();
const
[
error
,
setError
]
=
useState
(
""
);
const
[
error
,
setError
]
=
useState
(
""
);
const
[
disabled
,
setDisabled
]
=
useState
(
false
);
const
[
disabled
,
setDisabled
]
=
useState
(
false
);
const
[
success
,
setSuccess
]
=
useState
(
false
);
const
[
success
,
setSuccess
]
=
useState
(
false
);
...
@@ -39,8 +38,8 @@ export const SignUp = ({}: SignUpProps) => {
...
@@ -39,8 +38,8 @@ export const SignUp = ({}: SignUpProps) => {
try
{
try
{
console
.
log
(
"
checkPassword:
"
,
passwordmatch
());
console
.
log
(
"
checkPassword:
"
,
passwordmatch
());
if
(
passwordmatch
())
{
if
(
passwordmatch
())
{
//
const res = await axios.post("/api/signup", user);
const
res
=
await
axios
.
post
(
"
/api/
auth/
signup
"
,
user
);
//
console.log("서버연결됬나요", res);
console
.
log
(
"
서버연결됬나요
"
,
res
);
console
.
log
(
"
회원가입
"
);
console
.
log
(
"
회원가입
"
);
setSuccess
(
true
);
setSuccess
(
true
);
setError
(
""
);
setError
(
""
);
...
@@ -69,7 +68,6 @@ export const SignUp = ({}: SignUpProps) => {
...
@@ -69,7 +68,6 @@ export const SignUp = ({}: SignUpProps) => {
navigate
(
`../`
);
navigate
(
`../`
);
}
}
// const { name, email, password, password2 } = user;
return
(
return
(
<
div
className
=
"flex justify-center mt-3"
>
<
div
className
=
"flex justify-center mt-3"
>
<
div
className
=
"flex flex-col space-y-4 mt-5 text-xl font-bold"
>
<
div
className
=
"flex flex-col space-y-4 mt-5 text-xl font-bold"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment