Reset availability when the data came from an edit action

This commit is contained in:
Arnaud 2024-09-27 11:40:38 +02:00
parent dea9078379
commit fba2a20869
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663

View File

@ -100,11 +100,24 @@ export function AvailabilityCreate({ space }: Props) {
setAvailability(val);
};
const onOpen = () =>
const onOpen = () => {
if (availability.id) {
WebStorage.set("availability-step", 0);
WebStorage.set("availability", defaultAvailabilityData);
setAvailability(defaultAvailabilityData);
}
dispatch({
type: "open",
});
dispatch({
step: 0,
type: "next",
});
};
const onClose = () => dispatch({ type: "close" });
const Body = components[state.step] || (() => <span />);