| 1 |
import { getSiteProfile } from '@launch/api/DataApi'; |
| 2 |
import { useUserSelectionStore } from '@launch/state/user-selections'; |
| 3 |
import useSWRImmutable from 'swr/immutable'; |
| 4 |
|
| 5 |
export const useSiteProfile = () => { |
| 6 |
const { siteInformation, businessInformation } = useUserSelectionStore(); |
| 7 |
const { data, error } = useSWRImmutable( |
| 8 |
{ |
| 9 |
key: 'site-profile', |
| 10 |
title: siteInformation?.title, |
| 11 |
description: businessInformation?.description, |
| 12 |
}, |
| 13 |
getSiteProfile, |
| 14 |
); |
| 15 |
|
| 16 |
return { siteProfile: data, error, loading: !data && !error }; |
| 17 |
}; |
| 18 |
|