| 1 |
import { getSiteImages } from '@launch/api/DataApi'; |
| 2 |
import { useSiteProfile } from '@launch/hooks/useSiteProfile'; |
| 3 |
import useSWRImmutable from 'swr/immutable'; |
| 4 |
|
| 5 |
export const useSiteImages = () => { |
| 6 |
const { loading, siteProfile } = useSiteProfile(); |
| 7 |
const { data, error } = useSWRImmutable( |
| 8 |
loading ? null : { key: 'site-images', ...siteProfile }, |
| 9 |
getSiteImages, |
| 10 |
); |
| 11 |
return { siteImages: data, error, loading: !data && !error }; |
| 12 |
}; |
| 13 |
|