@@ -16,6 +16,7 @@ import { userState } from '@/recoil/atoms';
16
16
17
17
import Button from '@/components/@common/Button/Button' ;
18
18
import Fieldset from '@/components/@common/Fieldset/Fieldset' ;
19
+ import Spinner from '@/components/@common/Spinner/Spinner' ;
19
20
20
21
import { CACHE_KEY } from '@/constants/api' ;
21
22
import { DATE_TIME } from '@/constants/date' ;
@@ -54,17 +55,16 @@ function ScheduleAddModal({ dateInfo, closeModal }: ScheduleAddModalProps) {
54
55
55
56
const queryClient = useQueryClient ( ) ;
56
57
57
- const { data } = useQuery < AxiosResponse < CategoryType [ ] > , AxiosError > (
58
- CACHE_KEY . MY_CATEGORIES ,
59
- ( ) => categoryApi . getMy ( accessToken ) ,
60
- {
61
- onSuccess : ( data ) => onSuccessGetCategories ( data ) ,
62
- }
63
- ) ;
58
+ const { isLoading : isGetCategoryLoading , data } = useQuery <
59
+ AxiosResponse < CategoryType [ ] > ,
60
+ AxiosError
61
+ > ( CACHE_KEY . MY_CATEGORIES , ( ) => categoryApi . getMy ( accessToken ) , {
62
+ onSuccess : ( data ) => onSuccessGetCategories ( data ) ,
63
+ } ) ;
64
64
65
65
const categoryId = useControlledInput ( ) ;
66
66
67
- const { isLoading , mutate : postSchedule } = useMutation <
67
+ const { mutate : postSchedule } = useMutation <
68
68
AxiosResponse < { schedules : ScheduleType [ ] } > ,
69
69
AxiosError ,
70
70
Omit < ScheduleType , 'id' | 'categoryId' | 'colorCode' | 'categoryType' > ,
@@ -129,7 +129,9 @@ function ScheduleAddModal({ dateInfo, closeModal }: ScheduleAddModalProps) {
129
129
closeModal ( ) ;
130
130
} ;
131
131
132
- if ( isLoading ) return < > Loading</ > ;
132
+ if ( isGetCategoryLoading || data === undefined ) {
133
+ return < Spinner size = { 10 } /> ;
134
+ }
133
135
134
136
return (
135
137
< div css = { scheduleAddModal } >
0 commit comments