fix: changes to error on schedule name empty save (#24044)
* fix #21709: change to error on schedule name empty save * fix comments * minor enahncemnts --------- Co-authored-by: Volnei Munhoz <volnei.munhoz@gmail.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
This commit is contained in:
co-authored by
Volnei Munhoz
Anik Dhabal Babu
parent
f32ea8b4c5
commit
c13fce4483
@@ -120,6 +120,10 @@ export const AvailabilitySettingsWebWrapper = ({
|
||||
scheduleId && deleteMutation.mutate({ scheduleId });
|
||||
}}
|
||||
handleSubmit={async ({ dateOverrides, ...values }) => {
|
||||
if (!values.name.trim()) {
|
||||
showToast(t("schedule_name_cannot_be_empty"), "error");
|
||||
return;
|
||||
}
|
||||
scheduleId &&
|
||||
updateMutation.mutate({
|
||||
scheduleId,
|
||||
|
||||
@@ -4010,6 +4010,7 @@
|
||||
"choose_a_voice_for_your_agent": "Choose a voice for your agent",
|
||||
"trait": "Trait",
|
||||
"voice_id": "Voice ID",
|
||||
"schedule_name_cannot_be_empty": "Schedule name cannot be empty",
|
||||
"use_voice": "Use voice",
|
||||
"current_voice": "Current voice",
|
||||
"setup_incoming_agent": "Set up incoming agent",
|
||||
|
||||
@@ -7,7 +7,7 @@ export type TCreateInputSchema = {
|
||||
};
|
||||
|
||||
export const ZCreateInputSchema: z.ZodType<TCreateInputSchema> = z.object({
|
||||
name: z.string(),
|
||||
name: z.string().trim().min(1, "Schedule name cannot be empty"),
|
||||
schedule: z
|
||||
.array(
|
||||
z.array(
|
||||
|
||||
@@ -5,7 +5,7 @@ import { timeZoneSchema } from "@calcom/lib/dayjs/timeZone.schema";
|
||||
export const ZUpdateInputSchema = z.object({
|
||||
scheduleId: z.number(),
|
||||
timeZone: timeZoneSchema.optional(),
|
||||
name: z.string().optional(),
|
||||
name: z.string().trim().min(1, "Schedule name cannot be empty").optional(),
|
||||
isDefault: z.boolean().optional(),
|
||||
schedule: z
|
||||
.array(
|
||||
|
||||
Reference in New Issue
Block a user