@@ -50,45 +50,43 @@ export const __kakaologin = createAsyncThunk(
50
50
async ( code , thunkAPI ) => {
51
51
try {
52
52
console . log ( "페이로드?" , code ) ;
53
- const data = await axios
54
- . post ( "http://hayangaeul.shop/kakao/login" , { code } )
55
- . then ( ( res ) => {
56
- console . log ( "서버에서 보내는값?" , res . data . data ) ;
57
- const email = res . data . data . email ;
58
- localStorage . setItem ( "email" , email ) ;
59
- localStorage . setItem ( "socialCode" , "KAKAO" ) ;
53
+ const data = await instance . post ( "/kakao/login" , { code } ) . then ( ( res ) => {
54
+ console . log ( "서버에서 보내는값?" , res . data . data ) ;
55
+ const email = res . data . data . email ;
56
+ localStorage . setItem ( "email" , email ) ;
57
+ localStorage . setItem ( "socialCode" , "KAKAO" ) ;
60
58
61
- if ( res . data . message !== "non-member" ) {
62
- const accessToken = res . headers . get ( "Authorization" ) ;
63
- const nickname = res . data . data . nickname ;
64
- console . log ( nickname ) ;
65
- localStorage . setItem ( "token" , accessToken ) ;
66
- localStorage . setItem ( "nickname" , nickname ) ;
67
- alert ( "그님스에 오신걸 환영합니다" ) ;
68
- return window . location . assign ( "/main" ) ;
59
+ if ( res . data . message !== "non-member" ) {
60
+ const accessToken = res . headers . get ( "Authorization" ) ;
61
+ const nickname = res . data . data . nickname ;
62
+ console . log ( nickname ) ;
63
+ localStorage . setItem ( "token" , accessToken ) ;
64
+ localStorage . setItem ( "nickname" , nickname ) ;
65
+ alert ( "그님스에 오신걸 환영합니다" ) ;
66
+ return window . location . assign ( "/main" ) ;
69
67
70
- //멤버가 아닐시 프로필 정보를 받는 페이지로 돌려야함
71
- } else if ( res . data . message === "non-member" ) {
72
- alert ( "그님스를 이용하려면 프로필 정보를 입력해줘야합니다." ) ;
73
- return window . location . assign ( "/signup/setProfileName" ) ;
74
- }
75
- // const accessToken = res.headers.get("Authorization");
76
- // const nickname = res.data.nickname;
77
- // const email = res.data.email;
68
+ //멤버가 아닐시 프로필 정보를 받는 페이지로 돌려야함
69
+ } else if ( res . data . message === "non-member" ) {
70
+ alert ( "그님스를 이용하려면 프로필 정보를 입력해줘야합니다." ) ;
71
+ return window . location . assign ( "/signup/setProfileName" ) ;
72
+ }
73
+ // const accessToken = res.headers.get("Authorization");
74
+ // const nickname = res.data.nickname;
75
+ // const email = res.data.email;
78
76
79
- // // 유저 토큰,닉네임,이메일이 있다면 가져온 후 세팅
80
- // if (accessToken && nickname && email) {
81
- // localStorage.setItem("token", accessToken);
82
- // localStorage.setItem("nickname", nickname);
83
- // localStorage.setItem("email", email);
84
- // alert(`소셜로그인 인증 완료! ${nickname}님 환영합니다!`);
85
- // return window.location.assign("/");
86
- // }
87
- // else {
88
- // alert("인증 오류! 다시 시도해주세요!");
89
- // return window.location.assign("/");
90
- // }
91
- } ) ;
77
+ // // 유저 토큰,닉네임,이메일이 있다면 가져온 후 세팅
78
+ // if (accessToken && nickname && email) {
79
+ // localStorage.setItem("token", accessToken);
80
+ // localStorage.setItem("nickname", nickname);
81
+ // localStorage.setItem("email", email);
82
+ // alert(`소셜로그인 인증 완료! ${nickname}님 환영합니다!`);
83
+ // return window.location.assign("/");
84
+ // }
85
+ // else {
86
+ // alert("인증 오류! 다시 시도해주세요!");
87
+ // return window.location.assign("/");
88
+ // }
89
+ } ) ;
92
90
return thunkAPI . fulfillWithValue ( data ) ;
93
91
} catch ( error ) {
94
92
window . location . assign ( "/" ) ;
0 commit comments