-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9주차 작업물
- Loading branch information
Showing
113 changed files
with
1,043 additions
and
576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ node_modules | |
.vscode | ||
.github | ||
dist | ||
|
||
pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { RouterPath } from '@/app/routes'; | ||
import { Box, Text, Spinner, Heading } from '@chakra-ui/react'; | ||
|
||
export const DummyRedirectPage = () => { | ||
const [statusMessage, setStatusMessage] = useState( | ||
'유저 정보를 기다리고 있습니다...' | ||
); | ||
const [isLoading, setIsLoading] = useState(true); | ||
const navigate = useNavigate(); | ||
|
||
useEffect(() => { | ||
const params = new URLSearchParams(window.location.search); | ||
|
||
const accessToken = params.get('accessToken'); | ||
const refreshToken = params.get('refreshToken'); | ||
const isSinitto = params.get('isSinitto'); | ||
|
||
if (accessToken && refreshToken && isSinitto) { | ||
// 로컬 스토리지에 토큰 저장 | ||
localStorage.setItem('accessToken', accessToken); | ||
localStorage.setItem('refreshToken', refreshToken); | ||
localStorage.setItem('isSinitto', isSinitto); | ||
|
||
// isSinitto 상태에 따른 메시지 설정 | ||
setStatusMessage( | ||
isSinitto === 'true' | ||
? '시니또 더미데이터로 로그인 중입니다. 페이지 이동 중...' | ||
: '보호자 더미데이터로 로그인 중입니다. 페이지 이동 중...' | ||
); | ||
|
||
setTimeout(() => { | ||
setIsLoading(false); // 로딩 완료 | ||
navigate(isSinitto === 'true' ? RouterPath.SINITTO : RouterPath.GUARD); | ||
}, 2000); | ||
} else { | ||
console.error('Access or Refresh token not found in query parameters.'); | ||
setStatusMessage('[ERROR] 토큰이 존재하지 않습니다.'); | ||
|
||
setIsLoading(false); | ||
} | ||
}, [navigate]); | ||
|
||
return ( | ||
<Box textAlign='center' mt='50px'> | ||
<Heading as='h1' size='lg' mb='1rem'> | ||
더미데이터 로그인 | ||
</Heading> | ||
<Text fontSize='lg'>{statusMessage}</Text> | ||
{(isLoading || statusMessage === '유저 정보를 기다리고 있습니다...') && ( | ||
<Spinner size='lg' mt='1rem' /> | ||
)} | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { DummyRedirectPage } from './DummyRedirectPage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './dummy-redirect'; | ||
export * from './main'; | ||
export * from './redirect'; | ||
export * from './register'; |
8 changes: 5 additions & 3 deletions
8
src/pages/common/main/components/login-button/LoginButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.