Fix minor bugs in gift-context.tsx
This commit is contained in:
@@ -275,7 +275,7 @@ export const GiftProvider: React.FC<GiftProviderProps> = ({ children }) => {
|
||||
? readGiftCategories({
|
||||
path: { event_id: currentEventId },
|
||||
}).then((res) => res.data)
|
||||
: Promise.resolve(undefined),
|
||||
: Promise.resolve([]),
|
||||
enabled: !!currentEventId,
|
||||
});
|
||||
|
||||
@@ -385,10 +385,9 @@ export const GiftProvider: React.FC<GiftProviderProps> = ({ children }) => {
|
||||
if (currentCategoryId) {
|
||||
query.category_id = currentCategoryId;
|
||||
}
|
||||
// We don't need to add event_id to query since it's part of the path
|
||||
|
||||
if (!currentEventId) {
|
||||
return Promise.resolve(undefined);
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
return readGiftItems({
|
||||
@@ -396,7 +395,7 @@ export const GiftProvider: React.FC<GiftProviderProps> = ({ children }) => {
|
||||
query,
|
||||
}).then((res) => res.data);
|
||||
},
|
||||
enabled: !!(currentCategoryId || currentEventId),
|
||||
enabled: !!currentEventId,
|
||||
});
|
||||
|
||||
const refetchItems = async (categoryId?: string, eventId?: string) => {
|
||||
|
||||
Reference in New Issue
Block a user