Skip to content

Commit 8a209c0

Browse files
HotFix 카카오 로그인 모달 적용 이전으로 되돌림
HotFix 카카오 로그인 모달 적용 이전으로 되돌림
2 parents f2bd70a + b7b58c8 commit 8a209c0

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

src/components/login/KakaoLoginLoding.jsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,17 @@ import WelcomeModal from "../modal/WelcomeModal";
66

77
//인가코드를 백으로 전달하기 위한 페이지
88
const KakaoLoginLoding = () => {
9-
const [isModalOpen, setIsModalOpen] = useState(false);
10-
const [message, setMessage] = useState("");
11-
const [path, setPath] = useState("");
129
const dispatch = useDispatch();
1310

1411
// new URL 객체에서 searchParams객체의 get메소드를 사용하여 'code'키의 값을 추출
1512
const code = new URL(window.location.href).searchParams.get("code");
1613

1714
// 페이지가 로딩됨과 동시에 디스패치로 code 전달
1815
useEffect(() => {
19-
dispatch(__kakaologin({ code, setMessage, setPath, setIsModalOpen }));
16+
dispatch(__kakaologin(code));
2017
}, []);
2118
return (
2219
<div>
23-
{isModalOpen && <WelcomeModal message={message} path={path} />}
2420
<LoadingPage />
2521
</div>
2622
);

src/redux/modules/LoginSlice.jsx

+18-21
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export const __emailLogin = createAsyncThunk(
5050
export const __kakaologin = createAsyncThunk(
5151
"kakaologin",
5252
//전달 받은 코드 비동기로 처리
53-
async (code, thunkAPI, setMessage, setPath, setIsModalOpen) => {
53+
async (code, thunkAPI) => {
5454
try {
5555
const data = await instance
56-
.post("social/kakao-login", code)
56+
.post("social/kakao-login", { code })
5757
.then((res) => {
5858
const email = res.data.data.email;
5959
sessionStorage.setItem("email", email);
@@ -68,16 +68,13 @@ export const __kakaologin = createAsyncThunk(
6868
sessionStorage.setItem("userId", userId);
6969
sessionStorage.setItem("profileImage", profileImage);
7070
sessionStorage.setItem("socialCode", "social");
71-
setIsModalOpen(true);
72-
setMessage("그님스에 오신걸 환영합니다");
73-
setPath("/main");
74-
// return window.location.assign("/main");
71+
alert("그님스에 오신걸 환영합니다");
72+
return window.location.assign("/main");
7573

7674
//멤버가 아닐시 프로필 정보를 받는 페이지로 돌려야함
7775
} else if (res.data.message === "non-member") {
78-
setIsModalOpen(true);
79-
setMessage("그님스를 이용하려면 프로필 정보를 입력해줘야합니다.");
80-
setPath("/signup/setProfileName");
76+
alert("그님스를 이용하려면 프로필 정보를 입력해줘야합니다.");
77+
return window.location.assign("/signup/setProfileName");
8178
}
8279
});
8380
// return thunkAPI.fulfillWithValue(data);
@@ -178,18 +175,18 @@ const LoginSlice = createSlice({
178175
},
179176
extraReducers: {
180177
//카카오 소셜로그인
181-
// [__kakaologin.pending]: (state) => {
182-
// state.isLoading = true;
183-
// },
184-
// [__kakaologin.fulfilled]: (state, action) => {
185-
// state.isLoading = false;
186-
// state.loginCheck = true;
187-
// state.email = action.payload;
188-
// },
189-
// [__kakaologin.rejected]: (state, action) => {
190-
// state.isLoading = false;
191-
// state.error = action.payload;
192-
// },
178+
[__kakaologin.pending]: (state) => {
179+
state.isLoading = true;
180+
},
181+
[__kakaologin.fulfilled]: (state, action) => {
182+
state.isLoading = false;
183+
state.loginCheck = true;
184+
state.email = action.payload;
185+
},
186+
[__kakaologin.rejected]: (state, action) => {
187+
state.isLoading = false;
188+
state.error = action.payload;
189+
},
193190
[__sendEmail.pending]: (state) => {
194191
state.isLoading = true;
195192
},

0 commit comments

Comments
 (0)