-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(client): logout시 google 로그인 view #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
86482ab
6fb40fb
36f5f59
71b806b
cf9f13a
4448cbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import onBoardingBg from '/assets/onBoarding/background/onBoardingBg.webp'; | ||
| import Header from '@pages/onBoarding/components/header/Header'; | ||
| import Footer from '@pages/onBoarding/components/footer/Footer'; | ||
| import { Icon } from '@pinback/design-system/icons'; | ||
| import { handleGoogleLogin } from '@shared/utils/handleGoogleLogin'; | ||
| import { Link } from 'react-router-dom'; | ||
| import Chippi from '@assets/chippi_extension_popup.svg'; | ||
| import GoogleLogo from '/assets/onBoarding/icons/googleLogo.svg'; | ||
|
|
||
| const Login = () => { | ||
| return ( | ||
| <div | ||
| className="relative flex h-screen w-screen flex-col bg-cover bg-center bg-no-repeat" | ||
| style={{ backgroundImage: `url(${onBoardingBg})` }} | ||
| > | ||
| <Header /> | ||
|
|
||
| <main className="flex w-full flex-1 items-center justify-center"> | ||
| <div className="bg-white-bg flex h-[54.8rem] w-[63.2rem] flex-col items-center justify-center rounded-[2.4rem]"> | ||
| <img | ||
| src={Chippi} | ||
| alt="치삐 이미지" | ||
| className="mb-[1.6rem] h-[19.4rem] w-[19.4rem] object-contain" | ||
| /> | ||
|
|
||
| <Icon name={'logo'} height={34} width={123} className="mb-[1.6rem]" /> | ||
|
|
||
| <h1 className="head2 text-font-black-1 mb-[0.8rem] text-center"> | ||
| 가장 재미있게 북마크를 활용하는 방법 | ||
| </h1> | ||
|
|
||
| <p className="body2-m text-font-gray-3 mb-[3.5rem] text-center"> | ||
| 내가 저장해둔 영감을 pinback과 함께 열어볼까요? | ||
| </p> | ||
|
|
||
| <button | ||
| onClick={handleGoogleLogin} | ||
| className="sub2-sb flex h-[5.2rem] w-[29.8rem] items-center justify-between gap-3 rounded-full border border-gray-100 bg-white px-[2rem]" | ||
| > | ||
| <img | ||
| src={GoogleLogo} | ||
| alt="구글 로고" | ||
| className="h-[2.435rem] w-[2.435rem]" | ||
| /> | ||
| 구글 계정으로 로그인/회원가입 | ||
| </button> | ||
|
|
||
| <p className="text-font-gray-3 caption2-m mt-[2.4rem] text-center"> | ||
| 가입 시 pinback의{' '} | ||
| <Link | ||
| to="/terms" | ||
| className="underline underline-offset-2 hover:opacity-70" | ||
| > | ||
| 이용 약관 | ||
| </Link>{' '} | ||
| 및{' '} | ||
| <Link | ||
| to="/privacy" | ||
| className="underline underline-offset-2 hover:opacity-70" | ||
| > | ||
| 개인정보처리방침 | ||
| </Link> | ||
| 에 동의한 것으로 간주됩니다. | ||
| </p> | ||
| </div> | ||
| </main> | ||
|
|
||
| <Footer /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Login; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,11 +35,14 @@ apiRequest.interceptors.response.use( | |
| originalRequest.url?.includes(url) | ||
| ); | ||
|
|
||
| const isLoginPage = window.location.pathname.startsWith('/login'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기도 분리한 상수 써도 될 것 같아요! |
||
|
|
||
| if ( | ||
| error.response && | ||
| (error.response.status === 401 || error.response.status === 403) && | ||
| !originalRequest._retry && | ||
| !isNoAuth | ||
| !isNoAuth && | ||
| !isLoginPage | ||
| ) { | ||
| originalRequest._retry = true; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,20 @@ | ||||||||||||||||||||||||||||||||||
| export const handleGoogleLogin = () => { | ||||||||||||||||||||||||||||||||||
| const clientId = import.meta.env.VITE_GOOGLE_CLIENT_ID; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const redirectUri = import.meta.env.PROD | ||||||||||||||||||||||||||||||||||
| ? import.meta.env.VITE_GOOGLE_REDIRECT_URI_PROD | ||||||||||||||||||||||||||||||||||
| : import.meta.env.VITE_GOOGLE_REDIRECT_URI_DEV; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (!clientId || !redirectUri) { | ||||||||||||||||||||||||||||||||||
| alert('Google OAuth 설정이 누락되었습니다.'); | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| const googleAuthUrl = | ||||||||||||||||||||||||||||||||||
| `https://accounts.google.com/o/oauth2/v2/auth?` + | ||||||||||||||||||||||||||||||||||
| `client_id=${clientId}` + | ||||||||||||||||||||||||||||||||||
| `&redirect_uri=${redirectUri}` + | ||||||||||||||||||||||||||||||||||
| `&response_type=code` + | ||||||||||||||||||||||||||||||||||
| `&scope=email profile`; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| window.location.href = googleAuthUrl; | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. URL 파라미터를 인코딩해야 합니다.
🔎 제안하는 수정 사항 const googleAuthUrl =
`https://accounts.google.com/o/oauth2/v2/auth?` +
- `client_id=${clientId}` +
- `&redirect_uri=${redirectUri}` +
+ `client_id=${encodeURIComponent(clientId)}` +
+ `&redirect_uri=${encodeURIComponent(redirectUri)}` +
`&response_type=code` +
- `&scope=email profile`;
+ `&scope=${encodeURIComponent('email profile')}`;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
링크 경로 불일치를 수정하세요.
"이용 약관"과 "개인정보처리방침" 링크가 모두
/privacy를 가리키고 있습니다.Login.tsx(50-55번째 줄)에서는 "이용 약관"이/terms로, "개인정보처리방침"이/privacy로 올바르게 분리되어 있습니다. 일관성을 위해 여기서도 동일하게 수정해야 합니다.🔎 제안하는 수정 사항
📝 Committable suggestion
🤖 Prompt for AI Agents