From bda58225fe6d99e1c73a1095cca436ca8e6e544e Mon Sep 17 00:00:00 2001 From: DeDxYk594 Date: Sat, 14 Dec 2024 13:16:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/cardDetails.ts | 4 +++- src/containers/CardDetails.tsx | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/api/cardDetails.ts b/src/api/cardDetails.ts index 0227970..f5ffd9b 100644 --- a/src/api/cardDetails.ts +++ b/src/api/cardDetails.ts @@ -50,8 +50,10 @@ export const assignUser = async ( const body: UserResponse = response.body; return decodeUser(body); } + default: + showToast('Ошибка при назначении пользователя на карточку', 'error'); + return undefined; } - return undefined; }; export const deassignUser = async ( diff --git a/src/containers/CardDetails.tsx b/src/containers/CardDetails.tsx index 169ac1d..e33e5fa 100644 --- a/src/containers/CardDetails.tsx +++ b/src/containers/CardDetails.tsx @@ -167,6 +167,10 @@ export const CardDetailsContainer = (props: ComponentProps) => { const [assignedInput, setAssignedInput] = useState(false); const addCLF = () => { + if (newCheckListField.length < 3) { + showToast('Строка чеклиста должна быть от 3 символов', 'error'); + return; + } addCheckListField(cardDetails.card.id, newCheckListField).then((clf) => { if (clf !== undefined) { setNewCheckListField(''); @@ -178,6 +182,10 @@ export const CardDetailsContainer = (props: ComponentProps) => { }; const addComm = () => { + if (newComment.length < 3) { + showToast('Комментарий должен быть от 3 символов', 'error'); + return; + } createComment(cardDetails.card.id, newComment).then((comment) => { if (comment !== undefined) { setNewComment(''); @@ -189,6 +197,12 @@ export const CardDetailsContainer = (props: ComponentProps) => { }; const addAssigned = () => { + if (newAssigned.length < 3) { + if (newComment.length < 3) { + showToast('Имя польователя может быть от 3 символов', 'error'); + return; + } + } assignUser(cardDetails.card.id, newAssigned).then((u) => { if (u !== undefined) { setNewAssigned('');