From 01c1a737adbabc776c3808472ec4a9ed92b98cb7 Mon Sep 17 00:00:00 2001 From: ATeals Date: Mon, 25 Nov 2024 15:15:51 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20lotusQueryOptions=20query=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/frontend/src/feature/lotus/api.ts | 6 ------ apps/frontend/src/feature/lotus/query.ts | 24 ++++++------------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/apps/frontend/src/feature/lotus/api.ts b/apps/frontend/src/feature/lotus/api.ts index 1ded2d36..3752708f 100644 --- a/apps/frontend/src/feature/lotus/api.ts +++ b/apps/frontend/src/feature/lotus/api.ts @@ -1,7 +1,6 @@ import { LotusType } from './type'; import { CodeViewValue } from '@/feature/codeView'; import { api } from '@/shared/common/api'; -import { createQueryOptions } from '@/shared/createQueryOptions'; import { PageType } from '@/shared/pagination'; export const getLotusList = async ({ page = 1 }: { page: number }) => { @@ -77,8 +76,3 @@ export const createLotus = async ({ return data; }; - -export const lotusQueryOptions = createQueryOptions('lotus', { - list: getLotusList, - detail: getLotusDetail -}); diff --git a/apps/frontend/src/feature/lotus/query.ts b/apps/frontend/src/feature/lotus/query.ts index 7cd70c06..6ae94bda 100644 --- a/apps/frontend/src/feature/lotus/query.ts +++ b/apps/frontend/src/feature/lotus/query.ts @@ -1,23 +1,11 @@ -import { useMutation, useSuspenseQuery } from '@tanstack/react-query'; +import { useMutation } from '@tanstack/react-query'; import { createLotus, deleteLotus, getLotusDetail, getLotusList, updateLotus } from './api'; +import { createQueryOptions } from '@/shared/createQueryOptions'; -export const useLotusListSuspenseQuery = ({ page = 1 }: { page?: number } = {}) => { - const query = useSuspenseQuery({ - queryKey: ['lotus', page], - queryFn: async () => getLotusList({ page }) - }); - - return query; -}; - -export const useLotusSuspenseQuery = ({ id }: { id: string }) => { - const query = useSuspenseQuery({ - queryKey: ['lotus', 'detail', id], - queryFn: async () => getLotusDetail({ id }) - }); - - return query; -}; +export const lotusQueryOptions = createQueryOptions('lotus', { + list: getLotusList, + detail: getLotusDetail +}); export const useLotusDeleteMutation = () => { const mutation = useMutation({