Skip to content

Scheduling infrastructure for absolutely everyone.

feat: AvailabilitySettings atom toggle toasts (#17216)

Lauris Skraucisb7792d0d0aff
diff --git a/packages/platform/atoms/availability/wrappers/AvailabilitySettingsPlatformWrapper.tsx b/packages/platform/atoms/availability/wrappers/AvailabilitySettingsPlatformWrapper.tsx
index cad2cda2780..ca39fc3da26 100644
--- a/packages/platform/atoms/availability/wrappers/AvailabilitySettingsPlatformWrapper.tsx
+++ b/packages/platform/atoms/availability/wrappers/AvailabilitySettingsPlatformWrapper.tsx
@@ -35,6 +35,7 @@ type AvailabilitySettingsPlatformWrapperProps = {
onBeforeUpdate?: (updateBody: UpdateScheduleInput_2024_06_11) => boolean | Promise<boolean>;
allowDelete?: boolean;
allowSetToDefault?: boolean;
+ disableToasts?: boolean;
};
export const AvailabilitySettingsPlatformWrapper = ({
@@ -49,6 +50,7 @@ export const AvailabilitySettingsPlatformWrapper = ({
onBeforeUpdate,
allowDelete,
allowSetToDefault,
+ disableToasts,
}: AvailabilitySettingsPlatformWrapperProps) => {
const { isLoading, data: schedule } = useSchedule(id);
const { data: schedules } = useSchedules();
@@ -60,30 +62,38 @@ export const AvailabilitySettingsPlatformWrapper = ({
const { mutate: deleteSchedule, isPending: isDeletionInProgress } = useDeleteSchedule({
onSuccess: (res) => {
onDeleteSuccess?.(res);
- toast({
- description: "Schedule deleted successfully",
- });
+ if (!disableToasts) {
+ toast({
+ description: "Schedule deleted successfully",
+ });
+ }
},
onError: (err) => {
onDeleteError?.(err);
- toast({
- description: "Could not delete schedule",
- });
+ if (!disableToasts) {
+ toast({
+ description: "Could not delete schedule",
+ });
+ }
},
});
const { mutate: updateSchedule, isPending: isSavingInProgress } = useUpdateSchedule({
onSuccess: (res) => {
onUpdateSuccess?.(res);
- toast({
- description: "Schedule updated successfully",
- });
+ if (!disableToasts) {
+ toast({
+ description: "Schedule updated successfully",
+ });
+ }
},
onError: (err) => {
onUpdateError?.(err);
- toast({
- description: "Could not update schedule",
- });
+ if (!disableToasts) {
+ toast({
+ description: "Could not update schedule",
+ });
+ }
},
});