From 033b1403377f841abe7f9b55dbf41205241a052b Mon Sep 17 00:00:00 2001 From: iOdiO89 <117376841+iOdiO89@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:43:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20Next/Image=20=EB=8C=80=EC=8B=A0=20?= =?UTF-8?q?=EC=A7=81=EC=A0=91=20Import=20=ED=95=B4=EC=84=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/HeadFunction.tsx | 1 - components/home/certifyModal.tsx | 4 ++-- components/home/challengeBox.tsx | 1 - components/home/header.tsx | 10 ---------- components/home/searchBar.tsx | 7 ++++--- components/mypage/profile.tsx | 1 - pages/challenge/join.tsx | 1 - pages/index.tsx | 2 -- 8 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 components/home/header.tsx diff --git a/components/HeadFunction.tsx b/components/HeadFunction.tsx index 30c5a3f..4f91c3e 100644 --- a/components/HeadFunction.tsx +++ b/components/HeadFunction.tsx @@ -1,6 +1,5 @@ import { useRouter } from "next/router"; import FlexBox from "./Flexbox"; -import Image from "next/image"; import Head from "next/head"; import LeftArrowIcon from "@/public/svgs/LeftArrow.svg"; diff --git a/components/home/certifyModal.tsx b/components/home/certifyModal.tsx index 22c3532..6e5155e 100644 --- a/components/home/certifyModal.tsx +++ b/components/home/certifyModal.tsx @@ -2,7 +2,7 @@ import { InputError } from "@/pages/mypage/password"; import FlexBox from "../Flexbox"; import TextInput from "../Input"; import { useState } from "react"; -import Image from "next/image"; +import CloseIcon from "@/public/svgs/Close.svg"; interface CertifyModalProps { setIsModalVisible: React.Dispatch>; @@ -29,7 +29,7 @@ export default function CertifyModal({
챌린지 인증하기
setIsModalVisible(false)}> - +
diff --git a/components/home/challengeBox.tsx b/components/home/challengeBox.tsx index aae9041..2af7302 100644 --- a/components/home/challengeBox.tsx +++ b/components/home/challengeBox.tsx @@ -8,7 +8,6 @@ import { useAtom } from "jotai"; import CertifyModal from "./certifyModal"; import { useState } from "react"; import ReactModal from "react-modal"; -import Image from "next/image"; import { useGetMyChallengeList } from "@/apis/hooks/challenge"; interface HomeChallengeProps { diff --git a/components/home/header.tsx b/components/home/header.tsx deleted file mode 100644 index 05878a8..0000000 --- a/components/home/header.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { NextPage } from "next"; -import Image from "next/image"; - -export const HomeHeader: NextPage = () => { - return ( -
- -
- ); -}; diff --git a/components/home/searchBar.tsx b/components/home/searchBar.tsx index ced82e2..7db516f 100644 --- a/components/home/searchBar.tsx +++ b/components/home/searchBar.tsx @@ -1,6 +1,7 @@ import { NextPage } from "next"; import FlexBox from "../Flexbox"; -import Image from "next/image"; +import SearchIcon from "@/public/svgs/Search.svg"; +import CloseIcon from "@/public/svgs/Close_Circle.svg"; import { ChangeEvent } from "react"; interface SearchBarProps { @@ -20,7 +21,7 @@ export default function SearchBar({ value, setValue }: SearchBarProps) { return (
- +
- +
diff --git a/components/mypage/profile.tsx b/components/mypage/profile.tsx index 9b1a25f..2958b9c 100644 --- a/components/mypage/profile.tsx +++ b/components/mypage/profile.tsx @@ -1,4 +1,3 @@ -import Image from "next/image"; import FlexBox from "../Flexbox"; import { useRouter } from "next/router"; import RightArrowIcon from "@/public/svgs/RightArrow.svg"; diff --git a/pages/challenge/join.tsx b/pages/challenge/join.tsx index 8df79f1..ccae235 100644 --- a/pages/challenge/join.tsx +++ b/pages/challenge/join.tsx @@ -5,7 +5,6 @@ import NavBar from "@/components/NavBar"; import SearchBar from "@/components/home/searchBar"; import SearchResult from "@/components/home/searchResult"; import { NextPage } from "next"; -import Image from "next/image"; import { useState } from "react"; import { toast, ToastContainer, Zoom } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; diff --git a/pages/index.tsx b/pages/index.tsx index d5b3001..1c53497 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -3,11 +3,9 @@ import { NextPage } from "next"; import NavBar from "@/components/NavBar"; import Challenge from "@/components/home/challenge"; import HomeCarousel from "@/components/home/carousel"; -import { HomeHeader } from "@/components/home/header"; import HomeChallenge from "@/components/home/challengeBox"; import FlexBox from "@/components/Flexbox"; import { ToastContainer, Zoom, toast } from "react-toastify"; -import Image from "next/image"; import "react-toastify/dist/ReactToastify.css"; import CheckIcon from "@/public/svgs/Check.svg"; From f0c48266f9bd27e5d6be838fbbb40e03daab7eae Mon Sep 17 00:00:00 2001 From: iOdiO89 <117376841+iOdiO89@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:59:51 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20/challenges/attendance=20post=20API?= =?UTF-8?q?=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/challenge.ts | 13 +++++++++++++ apis/hooks/challenge.ts | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/apis/challenge.ts b/apis/challenge.ts index 3ea3c3b..40afdc3 100644 --- a/apis/challenge.ts +++ b/apis/challenge.ts @@ -25,6 +25,11 @@ interface getChallengeSearchResponse extends ResponseBody2 { result: Challenge[]; } +export interface AttendanceRequestBody { + challengeIdx: number; + attendanceCode: string; +} + async function getMyChallengeList(): Promise { const { data } = await client.get(`/challenges`); return data; @@ -49,9 +54,17 @@ async function postNewChallenge(challengeIdx: number): Promise { return data; } +async function postAttendance( + body: AttendanceRequestBody, +): Promise { + const { data } = await client.post(`/challenges/attendance`, body); + return data; +} + export { getMyChallengeList, getChallengeAds, getChallengeSearch, postNewChallenge, + postAttendance, }; diff --git a/apis/hooks/challenge.ts b/apis/hooks/challenge.ts index 3055a43..e990c9a 100644 --- a/apis/hooks/challenge.ts +++ b/apis/hooks/challenge.ts @@ -1,7 +1,9 @@ import { + AttendanceRequestBody, getChallengeAds, getChallengeSearch, getMyChallengeList, + postAttendance, postNewChallenge, } from "../challenge"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; @@ -54,9 +56,20 @@ function usePostNewChallenge( return { mutate }; } +function usePostAttendance() { + const queryClient = useQueryClient(); + const { mutate } = useMutation({ + mutationKey: ["postAttendance"], + mutationFn: (body: AttendanceRequestBody) => postAttendance(body), + }); + + return { mutate }; +} + export { useGetMyChallengeList, useGetChallengeAds, useGetChallengeSearch, usePostNewChallenge, + usePostAttendance, };