filter by selected day
This commit is contained in:
parent
69427a1a8d
commit
cfc51a9e0c
@ -23,13 +23,13 @@ export async function getSlots(input: GQL.GetSlotsQueryVariables) {
|
||||
|
||||
return api.getSlots({
|
||||
filters: {
|
||||
...input.filters,
|
||||
master: {
|
||||
documentId: {
|
||||
eq: customer.documentId,
|
||||
},
|
||||
},
|
||||
},
|
||||
...input.filters,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -14,8 +14,15 @@ export const ScheduleSlotsContext = createContext<ContextType>({} as ContextType
|
||||
export function ScheduleSlotsProvider({ children }: { readonly children: React.ReactNode }) {
|
||||
const [selectedDate, setSelectedDate] = useState(new Date());
|
||||
const { data: slots = [] } = useQuery({
|
||||
queryFn: () => getSlots({}),
|
||||
queryKey: ['schedule', 'slots'],
|
||||
queryFn: () =>
|
||||
getSlots({
|
||||
filters: {
|
||||
datestart: {
|
||||
gte: selectedDate,
|
||||
},
|
||||
},
|
||||
}),
|
||||
queryKey: ['schedule', 'slots', selectedDate],
|
||||
});
|
||||
|
||||
const value = useMemo(() => ({ selectedDate, setSelectedDate, slots }), [selectedDate, slots]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user