diff --git a/src/lib/api/remote/project.ts b/src/lib/api/remote/project.ts index 0cc85914..9782c6cd 100644 --- a/src/lib/api/remote/project.ts +++ b/src/lib/api/remote/project.ts @@ -1,18 +1,15 @@ -import { BASE_URL, DEFAULT_TIMEOUT } from '@src/lib/constants/client'; +import { BASE_URL } from '@src/lib/constants/client'; import axios from 'axios'; import qs from 'qs'; import { GetProjectDetailResponse, - GetProjectListResponse, ProjectAPI, ProjectCategoryType, ProjectPlatformType, + ProjectType, } from '../../types/project'; -const client = axios.create({ - baseURL: BASE_URL, - timeout: DEFAULT_TIMEOUT, -}); +const client = axios.create({ baseURL: BASE_URL }); const getProjectDetail = async (projectId: number): Promise => { const { data } = await client.get(`/projects/${projectId}`); @@ -26,12 +23,12 @@ const getProjectDetail = async (projectId: number): Promise => { +): Promise => { const categoryParameter = category === ProjectCategoryType.ALL ? {} : { filter: category }; const platformParameter = platform === ProjectPlatformType.ALL ? {} : { platform }; const parameter = qs.stringify({ ...categoryParameter, ...platformParameter }); const { data } = await client.get(`/projects?${parameter}`); - return { projects: data }; + return data; }; export const remoteProjectAPI: ProjectAPI = { diff --git a/src/lib/types/project.ts b/src/lib/types/project.ts index 1e2360bc..e276a387 100644 --- a/src/lib/types/project.ts +++ b/src/lib/types/project.ts @@ -56,14 +56,10 @@ export interface GetProjectDetailResponse { project: ProjectType; } -export interface GetProjectListResponse { - projects: ProjectType[]; -} - export interface ProjectAPI { getProjectDetail(projectId: number): Promise; getProjectList( category: ProjectCategoryType, platform: ProjectPlatformType, - ): Promise; + ): Promise; } diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 841da6a6..be5a26a9 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -4,8 +4,8 @@ import Head from 'next/head'; import { useRouter } from 'next/router'; import { Global } from '@emotion/react'; import { useEffect } from 'react'; -import { useState } from 'react'; import { QueryClient, QueryClientProvider } from 'react-query'; +import { ReactQueryDevtools } from 'react-query/devtools'; import SEO from '@src/components/common/SEO'; import GoogleTagManagerNoscript from '@src/components/googleTagManager/Noscript'; import GoogleTagManagerScript from '@src/components/googleTagManager/Script'; @@ -14,6 +14,18 @@ import { AMPLITUDE_API_KEY } from '@src/lib/constants/client'; import { global } from '@src/lib/styles/global'; import { pageViewTrackingEnrichment } from '@src/lib/utils/pageViewTrackingEnrichment'; +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + retry: 0, + suspense: true, + refetchOnWindowFocus: false, + refetchOnMount: false, + refetchOnReconnect: false, + }, + }, +}); + amplitude.add(pageViewTrackingEnrichment()); amplitude.init(AMPLITUDE_API_KEY, { logLevel: amplitude.Types.LogLevel.Warn, @@ -21,8 +33,6 @@ amplitude.init(AMPLITUDE_API_KEY, { }); function MyApp({ Component, pageProps }: AppProps) { - const [queryClient] = useState(() => new QueryClient()); - const router = useRouter(); useEffect(() => { router.events.on('routeChangeComplete', gtm.pageview); @@ -76,6 +86,7 @@ function MyApp({ Component, pageProps }: AppProps) { + diff --git a/src/views/BlogPage/components/BlogPost/index.tsx b/src/views/BlogPage/components/BlogPost/index.tsx index 760db823..88ff0e77 100644 --- a/src/views/BlogPage/components/BlogPost/index.tsx +++ b/src/views/BlogPage/components/BlogPost/index.tsx @@ -51,7 +51,7 @@ export default function BlogPost({ selectedTap, blogPost }: BlogPostProps) { (ProjectCategoryType.ALL); - const [selectedPlatform, setPlatform] = useState(ProjectPlatformType.ALL); - - const state = useFetch(selectedCategory, selectedPlatform); - const isMobile = useIsMobile('899px'); + const [selectedCategory, setCategory] = useStorage( + 'projectCategory', + 'sessionStorage', + ProjectCategoryType.ALL, + ); + const [selectedPlatform, setPlatform] = useStorage( + 'projectPlatform', + 'sessionStorage', + ProjectPlatformType.ALL, + ); return ( - SOPT{!isMobile && '에서 진행된'} 프로젝트 둘러보기 + + SOPT에서 진행된 프로젝트 둘러보기 +