Skip to content

Commit

Permalink
[Fix]OAuth로그인시 환영모달창 띄우지 않기
Browse files Browse the repository at this point in the history
기능작동 확인 필요
Issues #15
  • Loading branch information
김병현 authored and 김병현 committed Sep 18, 2023
1 parent ee444b4 commit 8d98758
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
5 changes: 0 additions & 5 deletions client/src/components/Logins/GoogleLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import React from 'react';
import styled from 'styled-components';
import { useDispatch } from 'react-redux';
import { setLoginState } from '../../reducer/member/loginSlice';
import googleLogo from '../../asset/images/GoogleLogo.svg';

const GoogleLoginButton: React.FC<Props> = ({ backendURL }) => {
const dispatch = useDispatch();

const buttonText = "구글로 로그인";

//버튼 클릭시 로그인 상태를 1로 변경
const handleLoginClick = () => {
window.location.href = `${backendURL}`;
dispatch(setLoginState());
};

return (
Expand Down
4 changes: 0 additions & 4 deletions client/src/components/Logins/KakaoLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import React from 'react';
import styled from 'styled-components';
import { useDispatch } from 'react-redux';
import { setLoginState } from '../../reducer/member/loginSlice';
import kakaoLogo from '../../asset/images/KakaoLogo.svg';

const KakaoLoginButton: React.FC<Props> = ({ backendURL }) => {
const dispatch = useDispatch();

const buttonText = "카카오로 로그인";

// 버튼 클릭시 로그인 페이지로 리다이렉트
const handleLoginClick = () => {
window.location.href = `${backendURL}`;
dispatch(setLoginState()); // 로그인 상태를 변경합니다.
};

return (
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/Logins/OAuthLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSelector } from 'react-redux';
import { RootState } from '../../store/config';


const OAuthLoginModal: React.FC<LoginModalProps> = ({ onClose, onEmailLoginClick, onEmailSignupClick, onLoginSuccess }) => {
const OAuthLoginModal: React.FC<LoginModalProps> = ({ onClose, onEmailLoginClick, onEmailSignupClick }) => {
const titleText = "로그인";
const orText = "또는";
const emailLoginText = "이메일로 로그인";
Expand All @@ -22,7 +22,6 @@ const OAuthLoginModal: React.FC<LoginModalProps> = ({ onClose, onEmailLoginClick
// 이미 로그인상태라면 모달창 닫기
useEffect(() => {
if (loginState === 1) {
onLoginSuccess();
onClose();
}
}, [loginState, onClose]);
Expand Down Expand Up @@ -51,7 +50,7 @@ interface LoginModalProps {
onClose: () => void;
onEmailLoginClick: () => void;
onEmailSignupClick: () => void;
onLoginSuccess: () => void;
onLoginSuccess?: () => void;
onWatchListClick: () => void;
onHoldingsClick: () => void;
}
Expand Down
1 change: 0 additions & 1 deletion client/src/page/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ const MainPage = () => {
onClose={closeOAuthModal}
onEmailLoginClick={openEmailLoginModal}
onEmailSignupClick={openEmailSignupModal}
onLoginSuccess={handleOAuthLoginSuccess} // 추가된 부분
onWatchListClick={() => handleMenuChange("관심종목")}
onHoldingsClick={() => handleMenuChange("보유종목")}
/>
Expand Down

0 comments on commit 8d98758

Please sign in to comment.