Skip to content

Commit

Permalink
Мелкие изменения
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDxYk594 committed Dec 14, 2024
1 parent 1c491af commit bda5822
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/cardDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
14 changes: 14 additions & 0 deletions src/containers/CardDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand All @@ -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('');
Expand All @@ -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('');
Expand Down

0 comments on commit bda5822

Please sign in to comment.