generated from nim-od/softeer-mono-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from softeerbootcamp4th/get-chatting-list
[Feature][Task-219] 채팅 리스트 불러오는 로직 구현 & loader, error element 역할 분리
- Loading branch information
Showing
15 changed files
with
186 additions
and
81 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import DeferredWrapper from 'src/components/common/DeferredWrapper.tsx'; | ||
import PendingContainer from 'src/components/common/PendingContainer.tsx'; | ||
|
||
export default function LayoutFallback() { | ||
return ( | ||
<DeferredWrapper> | ||
<PendingContainer message="사용자 정보를 불러오는 중입니다!" />; | ||
</DeferredWrapper> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
import { useRouteError } from 'react-router-dom'; | ||
import EventTimer from 'src/components/shared/timer/index.tsx'; | ||
import useGetEventDuration from 'src/hooks/query/useGetEventDuration.ts'; | ||
import ErrorPage from 'src/pages/error/ErrorPage.tsx'; | ||
import CustomError from 'src/utils/error.ts'; | ||
|
||
export default function NotStartedEventPage() { | ||
const error = useRouteError() as CustomError; | ||
|
||
const { | ||
duration: { startTime }, | ||
formattedDuration, | ||
} = useGetEventDuration(); | ||
|
||
return ( | ||
<div | ||
role="alert" | ||
className="gap-15 flex h-screen w-screen flex-col items-center justify-center p-[200px]" | ||
> | ||
<div className="flex min-w-max flex-col items-center gap-5"> | ||
<h3>이벤트가 시작하기까지</h3> | ||
<EventTimer endTime={startTime} /> | ||
<p className="text-detail-1 min-w-max font-medium text-neutral-300">{formattedDuration}</p> | ||
if (error.status === 403) { | ||
return ( | ||
<div | ||
role="alert" | ||
className="gap-15 flex h-screen w-screen flex-col items-center justify-center p-[200px]" | ||
> | ||
<div className="flex min-w-max flex-col items-center gap-5"> | ||
<h3>이벤트가 시작하기까지</h3> | ||
<EventTimer endTime={startTime} /> | ||
<p className="text-detail-1 min-w-max font-medium text-neutral-300"> | ||
{formattedDuration} | ||
</p> | ||
</div> | ||
<img | ||
src="/images/fcfs/modal.png" | ||
alt="오류 발생 이미지" | ||
className="w-full max-w-[1000px]" | ||
/> | ||
</div> | ||
<img src="/images/fcfs/modal.png" alt="오류 발생 이미지" className="w-full max-w-[1000px]" /> | ||
</div> | ||
); | ||
); | ||
} | ||
|
||
return <ErrorPage message={error.message} />; | ||
} |
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 { default as kakaoRedirectLoader } from './kakao-redirect.ts'; | ||
export { default as layoutLoader } from './layout.ts'; | ||
export { default as rootLoader } from './root.ts'; | ||
export { default as shareRedirectLoader } from './share-redirect.ts'; |
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,24 @@ | ||
import { ACCESS_TOKEN_KEY } from '@softeer/common/constants'; | ||
import { Cookie } from '@softeer/common/utils'; | ||
import { defer } from 'react-router-dom'; | ||
import { userInfoQueryOptions } from 'src/hooks/query/useGetUserInfo.ts'; | ||
import { queryClient } from 'src/libs/query/index.tsx'; | ||
import QUERY_KEYS from 'src/services/api/queryKey.ts'; | ||
|
||
export default async function layoutLoader() { | ||
const token = Cookie.getCookie<string | null>(ACCESS_TOKEN_KEY); | ||
|
||
if (token) { | ||
await queryClient.prefetchQuery(userInfoQueryOptions(token)); | ||
|
||
const userStatus = queryClient.getQueryState([QUERY_KEYS.USER_INFO, token]); | ||
|
||
if (userStatus?.status === 'error') { | ||
Cookie.clearCookie(ACCESS_TOKEN_KEY); | ||
} | ||
|
||
return defer({ userStatus }); | ||
} | ||
|
||
return null; | ||
} |
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.