Skip to content

Commit

Permalink
fix : 통신 , 버튼 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
beni1026 committed May 18, 2022
1 parent fdd06d3 commit f53ed70
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 45 deletions.
62 changes: 36 additions & 26 deletions booklog/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface loginDataInput {
const Login: NextPage<{ onChange: () => void }> = (props) => {
const [userEmail, setuserEmail] = useState("");
const [userPassword, setPassword] = useState("");
const [saveuserEmail, setSaveuserEmail] = useState(false);

const userEmailChangeHandler = (e:any) => {
setuserEmail(e.target.value);
Expand All @@ -26,32 +25,30 @@ const Login: NextPage<{ onChange: () => void }> = (props) => {

const onSubmitHandler = (e : any) => {
e.preventDefault();
if(userEmail != "" && userPassword != ""){
const loginData = {
Email: userEmail,
password: userPassword,
};
loginHandler(loginData);
}else{
//경고메시지 생성
}
loginHandler();
}

const loginHandler = (loginData: loginDataInput) => {
return;
axios.post('url',
{
userEmail: loginData.Email,
password: loginData.password
},
{
headers:{
'Content-type': 'application/json',
'Accept': 'application/json'
}
})
.then((res) => {console.log(res.data)})
.catch((res) => {console.log('Error!')});
const loginHandler = () => {
axios
.post(
"http://3.39.152.5:8080/login",
{
username: userEmail,
password: userPassword,
},
{
headers: {
"Content-type": "application/json",
Accept: "application/json",
},
}
)
.then((res) => {
console.log(res);
})
.catch((res) => {
console.log("Error!");
});
};


Expand Down Expand Up @@ -84,7 +81,7 @@ const Login: NextPage<{ onChange: () => void }> = (props) => {
<input id="userEmail-save" type="checkbox"></input>
<label htmlFor="userEmail-save">이메일 저장</label>
<br />
<Button>로그인</Button>
<button type="submit" className="loginBtn">로그인</button>
</form>
<p>다른 서비스 계정으로 로그인</p>
<button>구글 계정으로 로그인</button>
Expand Down Expand Up @@ -116,6 +113,19 @@ const Login: NextPage<{ onChange: () => void }> = (props) => {
height: 25px;
margin-bottom: 10px;
}
.loginBtn {
display: flex;
justify-content: center;
align-items: center;
background-color: #605ec9;
color: white;
border: 0px;
border-radius: 5px;
width: 100%;
height: 45px;
margin: 10px 0px;
cursor: pointer;
}
`}</style>
</>
);
Expand Down
19 changes: 7 additions & 12 deletions booklog/components/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,20 @@ const Signup: NextPage<{ onChange: () => void }> = (props) => {
};

const signUpHandler = (e:any) => {
console.log("버튼누름");
e.preventDefault();
return;
if(email != "" && password != ""){
axios
.post(
"url",
"http://3.39.152.5:8080/join",
{
username: name,
userEmail: email,
userPwd: password,
username: "euna",
password: "1234",
nickname: "euna"
},
{
headers: {
"Content-type": "application/json",
Accept: "application/json",
"Accept" : "application/json",
},
}
)
Expand All @@ -89,10 +88,6 @@ const Signup: NextPage<{ onChange: () => void }> = (props) => {
.catch((res) => {
console.log("Error!");
});
}else{
// 경고메시지 출력
}

};

return (
Expand Down Expand Up @@ -150,7 +145,7 @@ const Signup: NextPage<{ onChange: () => void }> = (props) => {
<button>약관보기</button>
</div>

<Button>가입하기</Button>
<button type="submit">가입하기</button>
<div className="other_signup">
<p>다른 서비스 계정으로 가입</p>
<button>구글 계정으로 가입</button>
Expand Down
6 changes: 3 additions & 3 deletions booklog/components/UI/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ interface LayoutProps {
children: React.ReactNode;
}

export default function Button({ children }: LayoutProps) {
export default function Button({ children, ...props }: LayoutProps) {
return (
<>
<div className="button">{children}</div>
<button {...props}>{children}</button>
<style jsx>{`
.button {
button {
display: flex;
justify-content: center;
align-items: center;
Expand Down
5 changes: 5 additions & 0 deletions booklog/components/portfolio/PortfolioList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const PortfolioList = () => {
return;
}

export default PortfolioList;
5 changes: 5 additions & 0 deletions booklog/components/portfolio/Profile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Profile = () => {
return;
};

export default Profile;
Empty file.
3 changes: 2 additions & 1 deletion booklog/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function MyApp({ Component, pageProps }: AppProps) {
<style global jsx>{`
html,
body,
div#__next {
div#__next,
div#__next > div {
height: 100%;
width: 100%;
margin: 0px;
Expand Down
26 changes: 23 additions & 3 deletions booklog/pages/portfolio.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
export default function portfolio() {
return <></>; //포트폴리오
}
import type { NextPage } from "next";

const portfolio: NextPage = () => {
return (
<>
<div className="book_review_list"></div>
<div className="my_profile"></div>
<style jsx>{`
.book_review_list {
width: 60%;
height: 100px;
background-color: black;
}
.my_profile {
width: 40%;
height: 100%;
}
`}</style>
</>
);
};

export default portfolio;

0 comments on commit f53ed70

Please sign in to comment.