From 7aee5b03bbb0fae66bdfb12779c73f2cd0da6867 Mon Sep 17 00:00:00 2001 From: Bhasher Date: Tue, 9 Jan 2024 02:06:11 +0100 Subject: [PATCH] Fix modalCard --- frontend/src/lib/api/cardsApi.ts | 15 ++-- frontend/src/lib/api/projectTagsApi.ts | 11 ++- frontend/src/lib/components/card/Card.svelte | 4 +- .../src/lib/components/card/ModalCard.svelte | 18 ++-- .../lib/components/tags/ModalNewTag.svelte | 15 ++-- .../src/lib/components/tags/ModalTag.svelte | 18 ++-- .../lib/components/tags/ModalTagTitle.svelte | 36 +++----- .../lib/components/tags/ModalTagValue.svelte | 10 +-- .../src/lib/components/tags/ModalTags.svelte | 16 ++-- .../src/lib/components/tags/SelectTags.svelte | 88 +++++-------------- frontend/src/lib/types/Card.ts | 31 +++++++ frontend/src/lib/types/ProjectTag.ts | 43 +++++++++ frontend/src/lib/types/TagOption.ts | 12 +++ 13 files changed, 173 insertions(+), 144 deletions(-) diff --git a/frontend/src/lib/api/cardsApi.ts b/frontend/src/lib/api/cardsApi.ts index c9625e3..ebc944d 100644 --- a/frontend/src/lib/api/cardsApi.ts +++ b/frontend/src/lib/api/cardsApi.ts @@ -17,11 +17,16 @@ async function create(projectId: number): Promise { return response.data.id; } -async function update(card: Card): Promise { - const response = await api.put(`/v1/cards/${card.id}`, { - project_id: card.project_id, - title: card.title, - content: card.content +async function update( + cardId: number, + projectId: number, + title: string, + content: string +): Promise { + const response = await api.put(`/v1/cards/${cardId}`, { + project_id: projectId, + title: title, + content: content }); if (response.status !== status.NoContent) { diff --git a/frontend/src/lib/api/projectTagsApi.ts b/frontend/src/lib/api/projectTagsApi.ts index 8b1d3ff..41e8eb2 100644 --- a/frontend/src/lib/api/projectTagsApi.ts +++ b/frontend/src/lib/api/projectTagsApi.ts @@ -4,9 +4,9 @@ import TagOption from '$lib/types/TagOption'; import api, { processError } from '$lib/utils/api'; import status from '$lib/utils/status'; -async function create(project: Project, title: string, type: number): Promise { +async function create(projectId: number, title: string, type: number): Promise { const response = await api.post(`/v1/tags/`, { - project_id: project.id, + project_id: projectId, title, type }); @@ -19,8 +19,11 @@ async function create(project: Project, title: string, type: number): Promise { - const response = await api.put(`/v1/tags/${tag.id}`, tag); +async function update(tagId: number, title: string, type: number): Promise { + const response = await api.put(`/v1/tags/${tagId}`, { + title, + type + }); if (response.status !== status.NoContent) { processError(response, 'Failed to update tag'); diff --git a/frontend/src/lib/components/card/Card.svelte b/frontend/src/lib/components/card/Card.svelte index 38de2ae..edf0529 100644 --- a/frontend/src/lib/components/card/Card.svelte +++ b/frontend/src/lib/components/card/Card.svelte @@ -2,7 +2,7 @@ import currentDraggedCard from '$lib/stores/currentDraggedCard'; import currentModalCard from '$lib/stores/currentModalCard'; import type Card from '$lib/types/Card'; - // import ModalCard from './ModalCard.svelte'; + import ModalCard from './ModalCard.svelte'; export let card: Card; @@ -34,7 +34,7 @@ - +