diff --git a/src/pages/join/login.tsx b/src/pages/join/login.tsx index d84838d..c97f6e2 100644 --- a/src/pages/join/login.tsx +++ b/src/pages/join/login.tsx @@ -1,102 +1,101 @@ -import * as S from 'src/styles/join/login.ts'; +import * as S from "src/styles/join/login.ts"; -import { useNavigate } from 'react-router-dom'; -import { useEffect } from 'react'; +import { useNavigate } from "react-router-dom"; +import { useEffect } from "react"; export const Login = () => { - const navigate = useNavigate(); - useEffect(() => { - const refToken = localStorage.getItem('refreshToken'); - if (refToken) { - navigate('/nickname'); - } - }, []); + const navigate = useNavigate(); + useEffect(() => { + const refToken = localStorage.getItem("refreshToken"); + if (refToken) { + navigate("/nickname"); + } + }, []); - const handleLogin = async () => { - // async function requestSafetyArea() { - // // React Native의 WebView로 권한 요청 메시지 전송 - // if ((window as any).ReactNativeWebView) { - // console.log('권한 요청 시도'); - // await (window as any).ReactNativeWebView.postMessage( - // JSON.stringify({ - // type: 'ADD_SAFETY_AREA', // 요청 유형을 변경 - // }) - // ); - // console.log('권한 요청 완료'); - // } - // } - // await requestSafetyArea(); + const handleLogin = async () => { + // async function requestSafetyArea() { + // // React Native의 WebView로 권한 요청 메시지 전송 + // if ((window as any).ReactNativeWebView) { + // console.log('권한 요청 시도'); + // await (window as any).ReactNativeWebView.postMessage( + // JSON.stringify({ + // type: 'ADD_SAFETY_AREA', // 요청 유형을 변경 + // }) + // ); + // console.log('권한 요청 완료'); + // } + // } + // await requestSafetyArea(); - const kakaoOauthUrl = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${process.env.REACT_APP_KAKAO_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_REDIRECT_URI}`; - window.location.href = kakaoOauthUrl; - localStorage.setItem('loginType', 'kakao'); - // const getCode = async () => { - // const res = axios.get(kakaoOauthUrl); - // console.log(res); - // }; - // getCode(); + const kakaoOauthUrl = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${process.env.REACT_APP_KAKAO_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_TEST_REDIRECT_URI}`; + window.location.href = kakaoOauthUrl; + localStorage.setItem("loginType", "kakao"); + // const getCode = async () => { + // const res = axios.get(kakaoOauthUrl); + // console.log(res); + // }; + // getCode(); - // setTimeout(() => { + // setTimeout(() => { - // console.log(urlParameter); - // const a = async () => { - // const res = await axios.post(`${process.env.REACT_APP_BASE_URL}`, data); - // return res; - // } + // console.log(urlParameter); + // const a = async () => { + // const res = await axios.post(`${process.env.REACT_APP_BASE_URL}`, data); + // return res; + // } - // }, 3000); - }; + // }, 3000); + }; - // const loginWithApple = async (e: any) => { - // e.preventDefault(); - // localStorage.setItem('loginType', 'apple'); + // const loginWithApple = async (e: any) => { + // e.preventDefault(); + // localStorage.setItem('loginType', 'apple'); - // console.log('sign in with apple'); + // console.log('sign in with apple'); - // (window as any).AppleID.auth.init({ - // responseType: 'code', - // responseMode: 'query', - // clientId: 'net.azurestaticapps.kind-pebble-0020f5710.5', - // redirectURI: 'https://kind-pebble-0020f5710.5.azurestaticapps.net/redirection', - // usePopup: false, - // }); + // (window as any).AppleID.auth.init({ + // responseType: 'code', + // responseMode: 'query', + // clientId: 'net.azurestaticapps.kind-pebble-0020f5710.5', + // redirectURI: 'https://kind-pebble-0020f5710.5.azurestaticapps.net/redirection', + // usePopup: false, + // }); - // try { - // const res = await (window as any).AppleID.auth.signIn(); - // console.log(res); - // } catch (error) { - // console.log(error); - // } - // }; + // try { + // const res = await (window as any).AppleID.auth.signIn(); + // console.log(res); + // } catch (error) { + // console.log(error); + // } + // }; - const loginWithApple = async () => { - localStorage.setItem('loginType', 'apple'); - // const appleOauthUrl = `https://appleid.apple.com/auth/authorize?response_type=code&client_id=${process.env.REACT_APP_APPLE_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_REDIRECT_URI}`; - const appleOauthUrl = - 'https://appleid.apple.com/auth/authorize?response_type=code&client_id=net.azurestaticapps.kind-pebble-0020f5710.5&redirect_uri=https://kind-pebble-0020f5710.5.azurestaticapps.net/redirection'; - window.location.href = appleOauthUrl; - }; + const loginWithApple = async () => { + localStorage.setItem("loginType", "apple"); + // const appleOauthUrl = `https://appleid.apple.com/auth/authorize?response_type=code&client_id=${process.env.REACT_APP_APPLE_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_REDIRECT_URI}`; + const appleOauthUrl = `https://appleid.apple.com/auth/authorize?response_type=code&client_id=net.azurestaticapps.kind-pebble-0020f5710.5&redirect_uri=${process.env.REACT_APP_TEST_REDIRECT_URI}`; + window.location.href = appleOauthUrl; + }; - return ( - - {/* */} - - - 간편하게 로그인하고 - 다양한 서비스를 이용해보세요 - - - - Apple로 로그인 - - - - Kakao로 로그인 - - - 계정 생성 시 개인정보 처리방침 및 - 이용약관에 동의하게 됩니다. - - - ); + return ( + + {/* */} + + + 간편하게 로그인하고 + 다양한 서비스를 이용해보세요 + + + + Apple로 로그인 + + + + Kakao로 로그인 + + + 계정 생성 시 개인정보 처리방침 및 + 이용약관에 동의하게 됩니다. + + + ); };