diff --git a/src/apis/client/getMyFootPrints.ts b/src/apis/client/getMyFootPrints.ts new file mode 100644 index 00000000..e26b0574 --- /dev/null +++ b/src/apis/client/getMyFootPrints.ts @@ -0,0 +1,19 @@ +import { DOMAIN } from '@/constants/api'; +import { + GetAllPlansRequestQuery, + GetAllPlansResponse, +} from '@/types/apis/plan/GetAllPlans'; +import { axiosInstanceClient } from '../axiosInstanceClient'; + +export const getMyFootPrints = async (query: GetAllPlansRequestQuery) => { + const { data } = await axiosInstanceClient.get( + DOMAIN.GET_PLANS_ALL, + { + authorization: false, + params: { + ...query, + }, + }, + ); + return data; +}; diff --git a/src/app/footprints/_Components/FootPrintList/FootPrintList.tsx b/src/app/footprints/_Components/FootPrintList/FootPrintList.tsx index 7e50e961..88f67afe 100644 --- a/src/app/footprints/_Components/FootPrintList/FootPrintList.tsx +++ b/src/app/footprints/_Components/FootPrintList/FootPrintList.tsx @@ -1,3 +1,6 @@ +'use client'; + +import { useMyFootPrintsQuery } from '@/hooks/apis/useMyFootPrintsQuery'; import classNames from 'classnames'; import React from 'react'; import FootprintItem from '../FootprintItem/FootprintItem'; @@ -9,74 +12,79 @@ interface FootPrintListProps { plan: planType; } -type FootPrintItemType = { - id: number; - iconNumber: number; - title: string; - createdAt: string; - ajajas: number; - tags: string[]; -}; +// type FootPrintItemType = { +// id: number; +// iconNumber: number; +// title: string; +// createdAt: string; +// ajajas: number; +// tags: string[]; +// }; -const dummyFootPrintList: FootPrintItemType[] = [ - { - id: 1, - iconNumber: 0, - title: '발자취1', - createdAt: '2024.04.22', - ajajas: 1, - tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], - }, - { - id: 2, - iconNumber: 1, - title: '발자취2', - createdAt: '2024.04.22', - ajajas: 2, - tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], - }, - { - id: 3, - iconNumber: 1, - title: '발자취3', - createdAt: '2024.04.22', - ajajas: 3, - tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], - }, - { - id: 4, - iconNumber: 0, - title: '발자취4', - createdAt: '2024.04.22', - ajajas: 1, - tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], - }, - { - id: 5, - iconNumber: 1, - title: '발자취5', - createdAt: '2024.04.22', - ajajas: 2, - tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], - }, - { - id: 6, - iconNumber: 1, - title: '발자취6', - createdAt: '2024.04.22', - ajajas: 3, - tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], - }, -]; +// const dummyFootPrintList: FootPrintItemType[] = [ +// { +// id: 1, +// iconNumber: 0, +// title: '발자취1', +// createdAt: '2024.04.22', +// ajajas: 1, +// tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], +// }, +// { +// id: 2, +// iconNumber: 1, +// title: '발자취2', +// createdAt: '2024.04.22', +// ajajas: 2, +// tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], +// }, +// { +// id: 3, +// iconNumber: 1, +// title: '발자취3', +// createdAt: '2024.04.22', +// ajajas: 3, +// tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], +// }, +// { +// id: 4, +// iconNumber: 0, +// title: '발자취4', +// createdAt: '2024.04.22', +// ajajas: 1, +// tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], +// }, +// { +// id: 5, +// iconNumber: 1, +// title: '발자취5', +// createdAt: '2024.04.22', +// ajajas: 2, +// tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], +// }, +// { +// id: 6, +// iconNumber: 1, +// title: '발자취6', +// createdAt: '2024.04.22', +// ajajas: 3, +// tags: ['태그1', '태그2', '태그3', '태그4', '태그5'], +// }, +// ]; export default function FootPrintList({ year, plan }: FootPrintListProps) { // TODO: prop으로 받은 year과 plan에 해당하는 발자취 list들을 서버로부터 받아온다. // - plan.planId === -1 => 모든 계획일 것 // - plan.planId === -2 => 해당 year에 해당하는 계획이 없는 것 + const { tempFootPrintList } = useMyFootPrintsQuery({ + sort: 'latest', + current: true, + }); + return (