🏆 할일
[x] 목데이터 완료하기
8-9 이동. 태도를 정돈하기 위해, 채근담을 읽기 시작했다.
9-10
10-12운동
12-1
1-2
2-3
3-4
4-5
5-6
6-7
7-8
8-9
9-10
허리가 너무 아파서, 요방근에 대한 유튜브를 몇 개 검색해보았다.
운동에 2시간 정도 시간이 드니까, 6시 30분부터 9시30분까지 위워크에 와서 학습을 하는 3시간 학습 > 운동 4시간 학습 > 밥먹기 3시간학습하는 10시간 루틴을 잘 짜나가야겠다.
내 성격도 매일매일이 훈련이다. 몸도 마음도 겉바속촉해지도록!
1) 로그인 & 회원가입
버튼의 onClick : 클라이언트에서 서버로 , fetch
fetch함수 : 주소, 메서드(get post->바디안에 보내고 싶은 값을 보내줌) delete ), 바디
POST { }
JSON, >
stringify > 서버에 보내줄 때는 스트링으로 바꿔줘요
그럼 인제 인증 인가를 서버에서 해주지...
-promise 객체를 반환...?
-토큰 : 사용자 정보를 해시로 알아볼수 없게
Response 오면 , JSON으로 바꾸어주고, 그걸 가지고
yes 인지 no인지에 따라 다른 함수 구현
fetch()
첫인자 :api,
둘째인자 : (객체) method
body : JSON.stringify( {} )
.then( res =res.json() )
.then (result = >console.log(result)
then = 그리고나서...?
필요한 것 : <주소> <body에 뭘 담아줘야.. key는? >
과제 :
-회원가입 성공
-duplicated 에러 콘솔찍기( 중복유저)
병수님꺼
fetch("http://10.58.1.171:8000/user/signup", {
method: "POST",
body: JSON.stringify({
email: this.state.inputId,
password: this.state.inputPw,
}),
})
.then((res) => res.json())
.then((result) => console.log("result>>>>>", result));
국현님꺼 : 추가 구현까지 해보았음
handleClick = (e) => {
e.preventDefault();
fetch("http://10.58.6.21:8000/user/signin", {
method: "POST",
body: JSON.stringify({
email: this.state.inputId,
password: this.state.inputPw,
}),
})
.then((res) => res.json())
.then((result) => {
console.log(result);
if (result.Authorization) {
console.log("굿굿구웃이에요");
} else {
alert(result.message);
}
});
};