Skip to content

Commit

Permalink
feat: 칸반보드 조회 API 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
2yunseong committed Sep 5, 2024
1 parent acfc153 commit 1d49915
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
10 changes: 7 additions & 3 deletions frontend/components/kanban/DragDrop.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ import { useAtom, useAtomValue } from "jotai";
import { KanbanSelectedButtonNumberState } from "@/src/stores/kanban/Navbar.atoms";
import useDragDrop from "@/src/hooks/useDragDrop.hook";

const KanbanColumnView = () => {
interface KanbanColumnViewProps {
generation: string;
}

const KanbanColumnView = ({ generation }: KanbanColumnViewProps) => {
const navbarId = useAtomValue(KanbanSelectedButtonNumberState);

const {
data: kanbanData,
isError,
isLoading,
} = useQuery<KanbanColumnData[]>(["kanbanDataArray", navbarId], () =>
getAllKanbanData(navbarId)
getAllKanbanData(navbarId, generation)
);

if (!kanbanData || isLoading) {
Expand Down Expand Up @@ -65,7 +69,7 @@ const KanbanBoardDragDropComponent = ({
ref={provided.innerRef}
{...provided.droppableProps}
>
<KanbanColumnView />
<KanbanColumnView generation={generation} />
<KanbanAddColumnComponent />
{provided.placeholder}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const KanbanColumnDetailCard = ({
isError,
isLoading,
} = useQuery<KanbanColumnData[]>(["kanbanDataArray", generation], () =>
getAllKanbanData(navbarId)
getAllKanbanData(navbarId, generation)
);

if (!kanbanDataArray || isLoading) {
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/apis/kanban/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export interface KanbanCardReq {
}

// TODO: card api 추가 시 수정 필요
export const getKanbanCards = async (columnId: string) => {
export const getKanbanCards = async (columnId: string, generation: string) => {
const { data } = await https.get<KanbanCardReq[]>(
`/navigations/${columnId}/boards`
`/navigations/${columnId}/boards?${new URLSearchParams({
year: generation,
})}`
);

return data;
Expand Down Expand Up @@ -90,10 +92,11 @@ export const postAddCard = async ({ columnId, title }: addCardReq) => {
};

export const getAllKanbanData = async (
navigationId: string
navigationId: string,
generation: string
): Promise<KanbanColumnData[]> => {
const columnsData = await getColums(navigationId);
const cardsData = await getKanbanCards(navigationId);
const cardsData = await getKanbanCards(navigationId, generation);

return columnsData.map((column) => {
const startColumnCardData = cardsData
Expand Down

0 comments on commit 1d49915

Please sign in to comment.