@@ -208,7 +235,7 @@ const TteokgukPage = () => {
떡국 재료 보내기
)}
- {isMyTteokguk && !completion && (
+ {isMyTteokguk && requiredIngredients.length !== 0 && !completion && (
)}
- {isMyTteokguk && completion && (
+ {isMyTteokguk && requiredIngredients.length === 0 && completion && (
)}
+ {isMyTteokguk && requiredIngredients.length === 0 && !completion && (
+
+ )}
{isMyTteokguk && (
diff --git a/src/routes/Routes.tsx b/src/routes/Routes.tsx
index 5fd1430..d10e261 100644
--- a/src/routes/Routes.tsx
+++ b/src/routes/Routes.tsx
@@ -15,11 +15,11 @@ import SearchUserPage from "@/pages/SearchUserPage";
import UserPage from "@/pages/UserPage";
import NotFoundPage from "@/pages/NotFoundPage";
import MainPageFallback from "@/pages/MainPage.fallback";
+import MyActivityPageFallback from "@/pages/MyActivityPage.fallback";
import ProtectedRoute from "./ProtectedRoute";
import Layout from "@/components/layout/Layout";
-import MyActivityPageFallback from "@/pages/MyActivityPage.fallback";
export type RoutePath =
| "/"
diff --git a/src/store/tteokguk.ts b/src/store/tteokguk.ts
index d27b243..bf4b028 100644
--- a/src/store/tteokguk.ts
+++ b/src/store/tteokguk.ts
@@ -1,4 +1,9 @@
-import { atomWithInfiniteQuery, atomWithMutation, atomWithQuery } from "jotai-tanstack-query";
+import {
+ atomWithInfiniteQuery,
+ atomWithMutation,
+ atomWithQuery,
+ queryClientAtom,
+} from "jotai-tanstack-query";
import { atomFamily } from "jotai/utils";
import { atom } from "jotai";
@@ -9,6 +14,7 @@ import {
postTteokguk,
deleteTteokguk,
getRandomTteokguk,
+ postCompleteTteokguk,
} from "@/apis/tteokguk";
import { atomFamilyWithQuery } from "@/utils/jotai";
@@ -96,3 +102,10 @@ export const $getRandomTteokguk = atomWithQuery(() => ({
queryFn: getRandomTteokguk,
enabled: false,
}));
+
+export const $postCompleteTteokguk = atomWithMutation((get) => ({
+ mutationFn: (id: number) => postCompleteTteokguk(id),
+ onSuccess: () => {
+ get(queryClientAtom).invalidateQueries({ queryKey: ["tteokguk"] });
+ },
+}));