refactor: rename product to partyEvent in API route, types and frontend components
This commit is contained in:
@@ -45,24 +45,24 @@ export function useGetPartyEvents() {
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type ProductData = {
|
||||
product: IPartyEventItem;
|
||||
type PartyEventData = {
|
||||
partyEvent: IPartyEventItem;
|
||||
};
|
||||
|
||||
export function useGetPartyEvent(productId: string) {
|
||||
const url = productId ? [endpoints.product.details, { params: { productId } }] : '';
|
||||
export function useGetPartyEvent(partyEventId: string) {
|
||||
const url = partyEventId ? [endpoints.partyEvent.details, { params: { partyEventId } }] : '';
|
||||
|
||||
const { data, isLoading, error, isValidating } = useSWR<ProductData>(url, fetcher, swrOptions);
|
||||
const { data, isLoading, error, isValidating } = useSWR<PartyEventData>(url, fetcher, swrOptions);
|
||||
|
||||
const memoizedValue = useMemo(
|
||||
() => ({
|
||||
partyEvent: data?.product,
|
||||
partyEvent: data?.partyEvent,
|
||||
partyEventLoading: isLoading,
|
||||
partyEventError: error,
|
||||
partyEventValidating: isValidating,
|
||||
mutate,
|
||||
}),
|
||||
[data?.product, error, isLoading, isValidating]
|
||||
[data?.partyEvent, error, isLoading, isValidating]
|
||||
);
|
||||
|
||||
return memoizedValue;
|
||||
|
Reference in New Issue
Block a user