Commit b3f9e9f7 authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

0704

parent 295f91db
import React from "react";
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
// type LoginProps = {
// };
export const Login = () => (
export const Login = () => {
// interface IUSER {
// email: string;
// password: string;
// }
// const [error, setError] = useState("");
// const [disabled, setDisabled] = useState(false);
// const [success, setSuccess] = useState(false);
// const navigate = useNavigate();
// function handleChange(event: type) {}
// function handleSubmit(params: type) {}
// if (success) {
// alert("회원가입 되었습니다");
// navigate(`../`);
// }
return (
<div className="flex justify-center mt-3">
<div className="flex flex-col space-y-4 mt-5 text-xl font-bold">
<label className="block text-gray-700 text-sm font-bold mb-2 mt-3">
......@@ -33,4 +54,5 @@ export const Login = () => (
</div>
</div>
</div>
);
);
};
import React, { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
// import axios from "axios";
import axios from "axios";
type SignUpProps = {};
export const SignUp = ({}: SignUpProps) => {
const USER = {
name: "",
email: "",
password: "",
password2: "",
};
// interface USER {
// name: "";
// email: "";
// password: "";
// password2: "";
// }
interface IUSER {
name: string;
email: string;
password: string;
password2: string;
}
const [user, setUser] = useState<IUSER>({
name: "user",
email: "user1234@naver.com",
password: "1234",
password2: "1234",
});
const [user, setUser] = useState(USER);
// const [user, setUser] = useState<USER>();
const [error, setError] = useState("");
const [disabled, setDisabled] = useState(false);
const [success, setSuccess] = useState(false);
......@@ -39,8 +38,8 @@ export const SignUp = ({}: SignUpProps) => {
try {
console.log("checkPassword:", passwordmatch());
if (passwordmatch()) {
// const res = await axios.post("/api/signup", user);
// console.log("서버연결됬나요", res);
const res = await axios.post("/api/auth/signup", user);
console.log("서버연결됬나요", res);
console.log("회원가입");
setSuccess(true);
setError("");
......@@ -69,7 +68,6 @@ export const SignUp = ({}: SignUpProps) => {
navigate(`../`);
}
// const { name, email, password, password2 } = user;
return (
<div className="flex justify-center mt-3">
<div className="flex flex-col space-y-4 mt-5 text-xl font-bold">
......
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