-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: useSuspenseQuery 적용 및 훅 리팩터링 (#326)
* chore: 확장자 tsx -> ts로 변경 * chore: Spinner 삭제 * chore: useReminderHooks, useCalendar 사용처로 폴더 이동 * build: react-query를 5.0.0-beta로 업데이트 * refactor: useSuspenseQuery 마이그레이션 * chore: 사용하지 않는 import 삭제 * chore: useDictionaryPlantDetail 네이밍 변경 적용 * chore: type import 추가 * refactor: 재사용되는 Skeleton 컴포넌트 추출 * fix: Spinner 대신 Loading 페이지로 변경 * refactor: query 커스텀 훅 변경내용 적용 * chore: useCheckSessionId 사용 안함 * build: package.json @tanstack/react-query: 5.0.0-beta.20 적용 * chore: 절대경로로 변경 * chore: hooks 폴더 안으로 이동 * style: 변수 구조분해 할당 * chore: 수정 함수를 그대로 사용 * refactor: refetch 대신 invalidateQueries 사용 * fix: history 모의 API 에도 세션 검층 추가
- Loading branch information
1 parent
8696c7a
commit c22cdc6
Showing
30 changed files
with
253 additions
and
334 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
23 changes: 0 additions & 23 deletions
23
frontend/src/components/@common/Spinner/Spinner.stories.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,32 @@ | ||
import { | ||
DayArea, | ||
DayHeader, | ||
SkeletonItem, | ||
SkeletonItemContent, | ||
TimelineArea, | ||
YearHeader, | ||
} from './Timeline.style'; | ||
|
||
interface SkeletonProps { | ||
hasYearHeader?: boolean; | ||
} | ||
|
||
const Skeleton = ({ hasYearHeader }: SkeletonProps) => ( | ||
<> | ||
{hasYearHeader && <YearHeader />} | ||
{Array(10) | ||
.fill(null) | ||
.map((_, index) => ( | ||
<DayArea key={index}> | ||
<DayHeader /> | ||
<TimelineArea> | ||
<SkeletonItem> | ||
<SkeletonItemContent /> | ||
</SkeletonItem> | ||
</TimelineArea> | ||
</DayArea> | ||
))} | ||
</> | ||
); | ||
|
||
export default Skeleton; |
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,19 +1,15 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import AuthAPI from 'apis/auth'; | ||
import throwOnInvalidStatus from 'utils/throwOnInvalidStatus'; | ||
|
||
const useLogin = (code: string) => { | ||
return useQuery<null, Error, void>({ | ||
const useLogin = (code: string) => | ||
useSuspenseQuery<null, Error, void>({ | ||
queryKey: ['getSession', code], | ||
queryFn: async () => { | ||
const response = await AuthAPI.getSessionId(code); | ||
|
||
throwOnInvalidStatus(response); | ||
|
||
return null; | ||
}, | ||
suspense: true, | ||
}); | ||
}; | ||
|
||
export default useLogin; |
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.