Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { queryFactory, QueryParams } from '@/shared/lib'
import { queryFetchPropertyById } from './requests'
import { Property, GET_PROPERTY_BY_ID_PRIMARY_KEY } from '../lib'
import { useRouter } from 'next/router'
const propertyByIdQuery = (id: string) =>
queryFactory(
GET_PROPERTY_BY_ID_PRIMARY_KEY,
queryFetchPropertyById(id)
)(filters => ({
params: filters,
}))
export const usePropertyById = (id: string, params?: QueryParams<Property>) => {
const { locale } = useRouter()
return propertyByIdQuery(id).useHookInitializer({
...params,
filters: {
locale,
...params?.filters,
},
})
}
|