-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ae01b3
commit 91668e1
Showing
9 changed files
with
75 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { carouselKeys, CAROUSEL_QUERY_KEYS } from 'api/carousel/carouselKeys' | ||
import { useToaster } from 'providers/ToastProvider' | ||
import { CarouselSlide, CarouselSlideParams } from 'models/carousel/carouselSlide' | ||
import { useQuery } from 'react-query' | ||
import http from 'api/http' | ||
|
||
const { CAROUSEL, SLIDES, GET_RAW } = CAROUSEL_QUERY_KEYS | ||
|
||
const fetchRawCarouselSlides = async (params?:CarouselSlideParams): Promise<CarouselSlide[]> => { | ||
const response = await http.get<CarouselSlide[]>(`${CAROUSEL}/${SLIDES}/${GET_RAW}`,{params}) | ||
return response.data | ||
} | ||
|
||
export const useFetchRawCarouselSlides = (params?:CarouselSlideParams) => { | ||
const toaster = useToaster() | ||
|
||
return useQuery({ | ||
queryFn: ()=>fetchRawCarouselSlides(params), | ||
queryKey: carouselKeys.getMany, | ||
staleTime: 1000 * 60 * 10, // stale for 10 minutes | ||
onError: toaster.onQueryError, | ||
}) | ||
} |
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,4 @@ | ||
export type CarouselSlideSearchInputOption = { | ||
value: string | number; | ||
label: string; | ||
} |