Skip to content

Commit

Permalink
refactor: 수정 페이지의 경로 activityId를 postId로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ccwnc committed Apr 10, 2024
1 parent 824481b commit 5347b51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/components/editPage/EditPageContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { useQuery } from '@tanstack/react-query';

import { getActivityDetail } from '@/apis/queryFunctions';
import { QUERY_KEYS } from '@/apis/queryKeys';
import { EditPageContentProps } from '@/pages/[game]/edit/[activityId]';
import { EditPageContentProps } from '@/pages/[game]/edit/[postId]';

import EditForm from '../EditForm';

import Banner from '@/components/layout/Banner';

const EditPageContent = ({ activityId, category }: EditPageContentProps) => {
const EditPageContent = ({ postId, category }: EditPageContentProps) => {
const { data } = useQuery({
queryKey: [QUERY_KEYS.activities.get, activityId],
queryKey: [QUERY_KEYS.activities.get, postId],
queryFn: getActivityDetail,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const { title, description, keywords } = META_DATA.edit;

export async function getServerSideProps(context: GetServerSidePropsContext) {
const game = context.params?.game;
const paramActivityId = context.params?.activityId;
const activityId = Number(paramActivityId);
const paramPostId = context.params?.postId;
const postId = Number(paramPostId);
const isValid = isValidGameName(game as string);

if (!isValid) {
Expand All @@ -36,26 +36,26 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const category = GAME_T0_CATEGORY[gameName];

queryClient.prefetchQuery({
queryKey: [QUERY_KEYS.activities.get, activityId],
queryKey: [QUERY_KEYS.activities.get, postId],
queryFn: getActivityDetail,
});

return {
props: { dehydratedState: dehydrate(queryClient), activityId, gameName, category },
props: { dehydratedState: dehydrate(queryClient), postId, gameName, category },
};
}

export type EditPageContentProps = {
activityId: number;
postId: number;
gameName: GameNameEN;
category: Category;
};

const EditPage = ({ activityId, gameName, category }: EditPageContentProps) => {
const EditPage = ({ postId, gameName, category }: EditPageContentProps) => {
return (
<>
<MetaData title={title} description={description} keywords={keywords} />
<EditPageContent activityId={activityId} gameName={gameName} category={category} />
<EditPageContent postId={postId} gameName={gameName} category={category} />
</>
);
};
Expand Down

0 comments on commit 5347b51

Please sign in to comment.