diff --git a/apps/client/src/pages/community/community-edit/community-edit.tsx b/apps/client/src/pages/community/community-edit/community-edit.tsx
index e6eea7f1..8ade834d 100644
--- a/apps/client/src/pages/community/community-edit/community-edit.tsx
+++ b/apps/client/src/pages/community/community-edit/community-edit.tsx
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';
+import { useMutation, useQueryClient } from '@tanstack/react-query';
import { useLocation, useParams } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
@@ -8,7 +9,8 @@ import { Icon } from '@bds/ui/icons';
import CommunityLine from '@widgets/community/components/community-line/community-line';
import { PLACEHOLDER } from '@widgets/community/constant/input-placeholder';
-import { PUT_FEED } from '@shared/api/domain/community/queries';
+import { COMMUNITY_MUTATION_OPTIONS } from '@shared/api/domain/community/queries';
+import { COMMUNITY_QUERY_KEY } from '@shared/api/keys/query-key';
import {
LIMIT_LONG_TEXT,
LIMIT_SHORT_TEXT,
@@ -29,26 +31,30 @@ const COMMUNITY_CONTENT = {
const CommunityEdit = () => {
const navigate = useNavigate();
const [isDisabled, setIsDisabled] = useState(true);
- const { mutate } = PUT_FEED(() => {
- navigate(routePath.COMMUNITY);
- });
+ const queryClient = useQueryClient();
+ const { postId } = useParams<{ postId: string }>();
const location = useLocation();
-
const state = location.state as { title: string; content: string };
const [title, setTitle] = useState(state.title);
const [content, setContent] = useState(state.content);
-
const { isErrorState } = useLimitedInput(LIMIT_SHORT_TEXT, title.length);
- const { postId } = useParams<{ postId: string }>();
-
if (!postId) {
- throw new Error('์๋ชป๋ ์ ๊ทผ์
๋๋ค.');
+ throw new Error('๊ฒ์๊ธ Id๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค.');
}
+ const { mutate } = useMutation({
+ ...COMMUNITY_MUTATION_OPTIONS.PUT_FEED(postId),
+ onSuccess: () => {
+ queryClient.invalidateQueries({
+ queryKey: COMMUNITY_QUERY_KEY.FEED_DETAIL(postId),
+ });
+ navigate(routePath.COMMUNITY_DETAIL.replace(':postId', postId));
+ },
+ });
+
const handlePutFeed = () => {
mutate({
- postId: postId,
body: {
title: title,
content: content,
diff --git a/apps/client/src/pages/community/community-page.tsx b/apps/client/src/pages/community/community-page.tsx
index 2a7a1547..fac5f6b8 100644
--- a/apps/client/src/pages/community/community-page.tsx
+++ b/apps/client/src/pages/community/community-page.tsx
@@ -21,9 +21,6 @@ const CommunityPage = () => {
const { data, fetchNextPage, hasNextPage, isFetchingNextPage } =
useInfiniteQuery({
...COMMUNITY_QUERY_OPTIONS.POSTS(),
- getNextPageParam: (lastPage) =>
- lastPage?.isLast ? undefined : lastPage?.nextCursor,
- initialPageParam: 0,
});
const feedObserverRef = useIntersectionObserver(() => {
diff --git a/apps/client/src/pages/community/community-write/community-write.tsx b/apps/client/src/pages/community/community-write/community-write.tsx
index c241e19a..ee47d2e4 100644
--- a/apps/client/src/pages/community/community-write/community-write.tsx
+++ b/apps/client/src/pages/community/community-write/community-write.tsx
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';
+import { useMutation, useQueryClient } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import { Input, Navigation, TextButton, Title } from '@bds/ui';
@@ -7,7 +8,8 @@ import { Icon } from '@bds/ui/icons';
import CommunityLine from '@widgets/community/components/community-line/community-line';
import { PLACEHOLDER } from '@widgets/community/constant/input-placeholder';
-import { usePostFeed } from '@shared/api/domain/community/queries';
+import { COMMUNITY_MUTATION_OPTIONS } from '@shared/api/domain/community/queries';
+import { COMMUNITY_QUERY_KEY } from '@shared/api/keys/query-key';
import {
LIMIT_LONG_TEXT,
LIMIT_SHORT_TEXT,
@@ -27,14 +29,19 @@ const COMMUNITY_CONTENT = {
const CommunityWrite = () => {
const navigate = useNavigate();
-
const [title, setTitle] = useState('');
const [content, setContent] = useState('');
-
const [isDisabled, setIsDisabled] = useState(true);
+ const queryClient = useQueryClient();
const { isErrorState } = useLimitedInput(LIMIT_SHORT_TEXT, title.length);
- const { mutate } = usePostFeed(() => {
- navigate(routePath.COMMUNITY);
+ const { mutate } = useMutation({
+ ...COMMUNITY_MUTATION_OPTIONS.POST_FEED(),
+ onSuccess: () => {
+ queryClient.invalidateQueries({
+ queryKey: COMMUNITY_QUERY_KEY.FEED_PREVIEW(),
+ });
+ navigate(routePath.COMMUNITY);
+ },
});
const handlePostFeed = () => {
diff --git a/apps/client/src/pages/my/my-page.tsx b/apps/client/src/pages/my/my-page.tsx
index 768b9a89..6f9ccbcd 100644
--- a/apps/client/src/pages/my/my-page.tsx
+++ b/apps/client/src/pages/my/my-page.tsx
@@ -14,8 +14,8 @@ const MyPage = () => {
const userData = queryData?.data;
const targetRoute = userData?.isRecommendInsurance
- ? routePath.HOME
- : `${routePath.ONBOARDING}?step=user`;
+ ? routePath.REPORT
+ : routePath.HOME;
const navigate = useNavigate();
diff --git a/apps/client/src/shared/api/domain/community/queries.ts b/apps/client/src/shared/api/domain/community/queries.ts
index 834f5600..2eed1881 100644
--- a/apps/client/src/shared/api/domain/community/queries.ts
+++ b/apps/client/src/shared/api/domain/community/queries.ts
@@ -1,14 +1,14 @@
import {
+ infiniteQueryOptions,
+ mutationOptions,
queryOptions,
- useMutation,
- useQueryClient,
} from '@tanstack/react-query';
import { END_POINT } from '@shared/api/config/end-point';
import { api } from '@shared/api/config/instance';
import {
+ COMMUNITY_MUTATION_KEY,
COMMUNITY_QUERY_KEY,
- POST_FEED_DETAIL_KEY,
} from '@shared/api/keys/query-key';
import {
CommentDeleteResponse,
@@ -23,16 +23,88 @@ import {
FeedUpdateResponse,
} from '@shared/api/types/types';
-export const POST_FEED_DETAIL_OPTIONS = {
- DETAIL: (postId: string) => {
+// =============================================================================
+// QUERY OPTIONS
+// =============================================================================
+
+export const COMMUNITY_QUERY_OPTIONS = {
+ POSTS: () =>
+ infiniteQueryOptions({
+ queryKey: COMMUNITY_QUERY_KEY.FEED_PREVIEW(),
+ queryFn: ({ pageParam = 0 }) =>
+ getAllFeed({ pageParam: pageParam as number }),
+ getNextPageParam: (lastPage) =>
+ lastPage?.isLast ? undefined : lastPage?.nextCursor,
+ initialPageParam: 0,
+ }),
+
+ COMMENTS: (postId?: string) =>
+ infiniteQueryOptions({
+ queryKey: COMMUNITY_QUERY_KEY.COMMENTS(postId),
+ queryFn: ({ pageParam = 0 }) => getAllComments(postId, { pageParam }),
+ getNextPageParam: (lastPage) =>
+ lastPage?.data?.nextCursor ? lastPage.data.nextCursor : undefined,
+ initialPageParam: 0,
+ }),
+
+ FEED_DETAIL: (postId: string) => {
return queryOptions({
- queryKey: POST_FEED_DETAIL_KEY.DETAIL(postId).concat(),
- queryFn: () => getFeedDeatil(postId),
+ queryKey: COMMUNITY_QUERY_KEY.FEED_DETAIL(postId).concat(),
+ queryFn: () => getFeedDetail(postId),
});
},
};
-export const getFeedDeatil = async (
+// =============================================================================
+// QUERY FUNCTIONS
+// =============================================================================
+
+/**
+ * ๋ชจ๋ ๊ฒ์๊ธ์ ํ์ด์ง๋ค์ด์
์ผ๋ก ๊ฐ์ ธ์ต๋๋ค.
+ * @param options - ํ์ด์ง๋ค์ด์
์ต์
+ * @param options.pageParam - ํ์ด์ง ํ๋ผ๋ฏธํฐ (๊ธฐ๋ณธ๊ฐ: 0)
+ * @returns ๊ฒ์๊ธ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์๋ต ๋ฐ์ดํฐ
+ */
+export const getAllFeed = async ({
+ pageParam,
+}: { pageParam?: number } = {}): Promise
=> {
+ const url =
+ pageParam === 0
+ ? `${END_POINT.COMMUNITY.GET_FEED}?size=10`
+ : `${END_POINT.COMMUNITY.GET_FEED}?cursor=${pageParam}&size=10`;
+
+ const response = await api.get(url).json();
+
+ return response.data;
+};
+
+/**
+ * ํน์ ๊ฒ์๊ธ์ ๋ชจ๋ ๋๊ธ์ ํ์ด์ง๋ค์ด์
์ผ๋ก ๊ฐ์ ธ์ต๋๋ค.
+ * @param postId - ๋๊ธ์ ๊ฐ์ ธ์ฌ ๊ฒ์๊ธ ID
+ * @param options - ํ์ด์ง๋ค์ด์
์ต์
+ * @param options.pageParam - ํ์ด์ง ํ๋ผ๋ฏธํฐ (๊ธฐ๋ณธ๊ฐ: 0)
+ * @returns ๋๊ธ ์๋ต ๋ฐ์ดํฐ ๋๋ null
+ */
+export const getAllComments = async (
+ postId?: string,
+ { pageParam }: { pageParam?: number } = {},
+): Promise => {
+ const url =
+ pageParam === 0
+ ? `${END_POINT.COMMUNITY.GET_COMMENTS(postId)}?size=10`
+ : `${END_POINT.COMMUNITY.GET_COMMENTS(postId)}?cursor=${pageParam}&size=10`;
+
+ const response = await api.get(url).json();
+
+ return response;
+};
+
+/**
+ * ํน์ ๊ฒ์๊ธ์ ์์ธ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
+ * @param postId - ์์ธ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ฌ ๊ฒ์๊ธ ID
+ * @returns ๊ฒ์๊ธ ์์ธ ์๋ต ๋ฐ์ดํฐ ๋๋ null
+ */
+export const getFeedDetail = async (
postId: string,
): Promise => {
const response = await api
@@ -42,6 +114,59 @@ export const getFeedDeatil = async (
return response.data;
};
+// =============================================================================
+// MUTATION OPTIONS
+// =============================================================================
+
+export const COMMUNITY_MUTATION_OPTIONS = {
+ POST_COMMENT: () => {
+ return mutationOptions({
+ mutationKey: COMMUNITY_MUTATION_KEY.POST_COMMENT(),
+ mutationFn: postComment,
+ });
+ },
+
+ POST_FEED: () => {
+ return mutationOptions({
+ mutationKey: COMMUNITY_MUTATION_KEY.POST_FEED(),
+ mutationFn: postFeed,
+ });
+ },
+
+ PUT_FEED: (postId: string) => {
+ return mutationOptions({
+ mutationKey: COMMUNITY_MUTATION_KEY.PUT_FEED(postId),
+ mutationFn: ({ body }: { body: FeedUpdateRequestBody }) =>
+ putFeed(postId, body),
+ });
+ },
+
+ DELETE_FEED: (postId: string) => {
+ return mutationOptions({
+ mutationKey: COMMUNITY_MUTATION_KEY.DELETE_FEED(postId),
+ mutationFn: () => deleteFeed(postId),
+ });
+ },
+
+ DELETE_COMMENT: (postId: string) => {
+ return mutationOptions({
+ mutationKey: COMMUNITY_MUTATION_KEY.DELETE_COMMENT(postId),
+ mutationFn: (commentId?: string) => deleteComment(postId, commentId),
+ });
+ },
+};
+
+// =============================================================================
+// MUTATION FUNCTIONS
+// =============================================================================
+
+/**
+ * ๊ฒ์๊ธ์ ๋๊ธ์ ์์ฑํฉ๋๋ค.
+ * @param params - ๋๊ธ ์์ฑ ํ๋ผ๋ฏธํฐ
+ * @param params.postId - ๋๊ธ์ ์์ฑํ ๊ฒ์๊ธ ID
+ * @param params.content - ๋๊ธ ๋ด์ฉ
+ * @returns ๋๊ธ ์์ฑ ์๋ต ๋ฐ์ดํฐ
+ */
export const postComment = async (params: {
postId: string;
content: string;
@@ -55,43 +180,23 @@ export const postComment = async (params: {
.json();
};
-export const POST_COMMENT = (onSuccessCallback?: () => void) => {
- const queryClient = useQueryClient();
-
- return useMutation({
- mutationFn: postComment,
- onSuccess: (_data, variables) => {
- queryClient.invalidateQueries({
- queryKey: COMMUNITY_QUERY_KEY.COMMENTS(variables.postId),
- });
- queryClient.invalidateQueries({
- queryKey: POST_FEED_DETAIL_KEY.DETAIL(variables.postId),
- });
- if (onSuccessCallback) {
- onSuccessCallback();
- }
- },
- });
-};
-
+/**
+ * ์ ๊ฒ์๊ธ์ ์์ฑํฉ๋๋ค.
+ * @param body - ๊ฒ์๊ธ ์์ฑ ์์ฒญ ๋ฐ์ดํฐ
+ * @returns ๊ฒ์๊ธ ์์ฑ ์๋ต ๋ฐ์ดํฐ
+ */
export const postFeed = async (body: FeedRequest): Promise => {
return api
.post(END_POINT.COMMUNITY.POST_FEED, { json: body })
.json();
};
-export const usePostFeed = (onSuccessCallback?: () => void) => {
- return useMutation({
- mutationFn: postFeed,
- onSuccess: () => {
- // @TODO ๊ฒ์๊ธ ์กฐํ ์ฟผ๋ฆฌํค ์ด๊ธฐํ ๋ก์ง ์ถ๊ฐ
- if (onSuccessCallback) {
- onSuccessCallback();
- }
- },
- });
-};
-
+/**
+ * ๊ธฐ์กด ๊ฒ์๊ธ์ ์์ ํฉ๋๋ค.
+ * @param postId - ์์ ํ ๊ฒ์๊ธ ID
+ * @param body - ๊ฒ์๊ธ ์์ ์์ฒญ ๋ฐ์ดํฐ
+ * @returns ๊ฒ์๊ธ ์์ ์๋ต ๋ฐ์ดํฐ
+ */
export const putFeed = async (
postId: string,
body: FeedUpdateRequestBody,
@@ -103,70 +208,13 @@ export const putFeed = async (
.json();
};
-export const PUT_FEED = (onSuccessCallback?: () => void) => {
- const queyrClient = useQueryClient();
-
- return useMutation({
- mutationFn: ({
- postId,
- body,
- }: {
- postId: string;
- body: FeedUpdateRequestBody;
- }) => putFeed(postId, body),
- onSuccess: async (_data, variables) => {
- await queyrClient.invalidateQueries({
- queryKey: POST_FEED_DETAIL_KEY.DETAIL(variables.postId),
- });
-
- if (onSuccessCallback) {
- onSuccessCallback;
- }
- },
- });
-};
-
-export const COMMUNITY_QUERY_OPTIONS = {
- COMMENTS: (postId?: string) => ({
- queryKey: COMMUNITY_QUERY_KEY.COMMENTS(postId),
- queryFn: ({ pageParam = 0 }) => getAllComments(postId, { pageParam }),
- }),
- POSTS: () => ({
- queryKey: POST_FEED_DETAIL_KEY.FEED(),
- queryFn: ({ pageParam = 0 }) =>
- getAllPosts({ pageParam: pageParam as number }),
- }),
-};
-
-export const getAllPosts = async ({
- pageParam,
-}: { pageParam?: number } = {}): Promise => {
- const url =
- pageParam === 0
- ? `${END_POINT.COMMUNITY.GET_FEED}?size=10`
- : `${END_POINT.COMMUNITY.GET_FEED}?cursor=${pageParam}&size=10`;
-
- const response = await api.get(url).json();
-
- return response.data;
-};
-
-export const getAllComments = async (
- postId?: string,
- { pageParam }: { pageParam?: number } = {},
-): Promise => {
- const url =
- pageParam === 0
- ? `${END_POINT.COMMUNITY.GET_COMMENTS(postId)}?size=10`
- : `${END_POINT.COMMUNITY.GET_COMMENTS(postId)}?cursor=${pageParam}&size=10`;
-
- const response = await api.get(url).json();
-
- return response;
-};
-
+/**
+ * ๊ฒ์๊ธ์ ์ญ์ ํฉ๋๋ค.
+ * @param postId - ์ญ์ ํ ๊ฒ์๊ธ ID
+ * @returns ๊ฒ์๊ธ ์ญ์ ์๋ต ๋ฐ์ดํฐ
+ */
export const deleteFeed = async (
- postId?: string,
+ postId: string,
): Promise => {
const response = await api
.delete(`${END_POINT.COMMUNITY.DELETE_FEED}/${postId}`)
@@ -174,20 +222,12 @@ export const deleteFeed = async (
return response;
};
-export const useDeleteFeed = (onSuccessCallback?: () => void) => {
- const queryClient = useQueryClient();
-
- return useMutation({
- mutationFn: (postId: string) => deleteFeed(postId),
- onSuccess: async () => {
- await queryClient.invalidateQueries({ queryKey: ['feeds'] });
- if (onSuccessCallback) {
- onSuccessCallback();
- }
- },
- });
-};
-
+/**
+ * ๋๊ธ์ ์ญ์ ํฉ๋๋ค.
+ * @param postId - ๋๊ธ์ด ์ํ ๊ฒ์๊ธ ID
+ * @param commentId - ์ญ์ ํ ๋๊ธ ID
+ * @returns ๋๊ธ ์ญ์ ์๋ต ๋ฐ์ดํฐ
+ */
export const deleteComment = async (
postId?: string,
commentId?: string,
@@ -199,26 +239,3 @@ export const deleteComment = async (
.json();
return response;
};
-
-export const useDeleteComment = (
- postId: string,
- onSuccessCallback?: () => void,
-) => {
- const queryClient = useQueryClient();
-
- return useMutation({
- mutationFn: (commentId?: string) => deleteComment(postId, commentId),
- onSuccess: async () => {
- await queryClient.invalidateQueries({
- queryKey: COMMUNITY_QUERY_KEY.COMMENTS(postId),
- });
- await queryClient.invalidateQueries({
- queryKey: POST_FEED_DETAIL_KEY.DETAIL(postId),
- });
-
- if (onSuccessCallback) {
- onSuccessCallback();
- }
- },
- });
-};
diff --git a/apps/client/src/shared/api/domain/landing/queries.ts b/apps/client/src/shared/api/domain/landing/queries.ts
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/client/src/shared/api/domain/mypage/queries.ts b/apps/client/src/shared/api/domain/mypage/queries.ts
index bff1aedd..90f3ce0c 100644
--- a/apps/client/src/shared/api/domain/mypage/queries.ts
+++ b/apps/client/src/shared/api/domain/mypage/queries.ts
@@ -1,4 +1,4 @@
-import { queryOptions } from '@tanstack/react-query';
+import { infiniteQueryOptions, queryOptions } from '@tanstack/react-query';
import { END_POINT } from '@shared/api/config/end-point.ts';
import { api } from '@shared/api/config/instance';
@@ -6,20 +6,29 @@ import { USER_QUERY_KEY } from '@shared/api/keys/query-key.ts';
import { MePostResponse, UserProfile } from '@shared/api/types/types';
export const USER_QUERY_OPTIONS = {
- PROFILE: () => {
- return queryOptions({
+ PROFILE: () =>
+ queryOptions({
queryKey: USER_QUERY_KEY.PROFILE(),
queryFn: getUserProfile,
- });
- },
- ME_POSTS: () => ({
- queryKey: USER_QUERY_KEY.ME_POSTS(),
- queryFn: ({ pageParam = 0 }) => getMePosts({ pageParam }),
- }),
- ME_COMMENTS: () => ({
- queryKey: USER_QUERY_KEY.ME_COMMENTS(),
- queryFn: ({ pageParam = 0 }) => getMeComments({ pageParam }),
- }),
+ }),
+
+ ME_POSTS: () =>
+ infiniteQueryOptions({
+ queryKey: USER_QUERY_KEY.ME_POSTS(),
+ queryFn: ({ pageParam = 0 }) => getMePosts({ pageParam }),
+ getNextPageParam: (lastPage) =>
+ lastPage.isLast ? undefined : lastPage.nextCursor,
+ initialPageParam: 0,
+ }),
+
+ ME_COMMENTS: () =>
+ infiniteQueryOptions({
+ queryKey: USER_QUERY_KEY.ME_COMMENTS(),
+ queryFn: ({ pageParam = 0 }) => getMeComments({ pageParam }),
+ getNextPageParam: (lastPage) =>
+ lastPage.isLast ? undefined : lastPage.nextCursor,
+ initialPageParam: 0,
+ }),
};
export const getUserProfile = async (): Promise => {
diff --git a/apps/client/src/shared/api/keys/query-key.ts b/apps/client/src/shared/api/keys/query-key.ts
index bebaa5a8..8fdf30c9 100644
--- a/apps/client/src/shared/api/keys/query-key.ts
+++ b/apps/client/src/shared/api/keys/query-key.ts
@@ -22,21 +22,37 @@ export const USER_QUERY_KEY = {
export const COMMUNITY_QUERY_KEY = {
ALL: ['community'],
- FEED: () => [...COMMUNITY_QUERY_KEY.ALL, 'feed'],
+ FEED_PREVIEW: () => [...COMMUNITY_QUERY_KEY.ALL, 'feed'],
+ FEED_DETAIL: (postId: string) => [
+ ...COMMUNITY_QUERY_KEY.ALL,
+ 'detail',
+ postId,
+ ],
COMMENTS: (postId?: string) => [
...COMMUNITY_QUERY_KEY.ALL,
'comment',
postId,
],
-};
+} as const;
+
+export const COMMUNITY_MUTATION_KEY = {
+ POST_COMMENT: () => [...COMMUNITY_QUERY_KEY.COMMENTS(), 'create'],
+ POST_FEED: () => [...COMMUNITY_QUERY_KEY.FEED_PREVIEW(), 'create'],
+ PUT_FEED: (postId: string) => [
+ ...COMMUNITY_QUERY_KEY.FEED_DETAIL(postId),
+ 'update',
+ ],
+ DELETE_FEED: (postId: string) => [
+ ...COMMUNITY_QUERY_KEY.FEED_DETAIL(postId),
+ 'delete',
+ ],
+ DELETE_COMMENT: (postId: string) => [
+ ...COMMUNITY_QUERY_KEY.COMMENTS(postId),
+ 'delete',
+ ],
+} as const;
export const HOME_QUERY_KEY = {
ALL: ['home'],
REPORT_SUMMARY: () => [...HOME_QUERY_KEY.ALL, 'report_summary'],
} as const;
-
-export const POST_FEED_DETAIL_KEY = {
- ALL: ['details'],
- DETAIL: (postId: string) => [...POST_FEED_DETAIL_KEY.ALL, 'detail', postId],
- FEED: () => [...POST_FEED_DETAIL_KEY.ALL, 'feed'],
-};
diff --git a/apps/client/src/shared/api/types/types.ts b/apps/client/src/shared/api/types/types.ts
index 4dbc7f9a..24215acc 100644
--- a/apps/client/src/shared/api/types/types.ts
+++ b/apps/client/src/shared/api/types/types.ts
@@ -1,88 +1,181 @@
import { paths } from '@shared/types/schema';
-// USER
+/* =======================================================
+ * ๐ USER ๊ด๋ จ ํ์
+ * ======================================================= */
+
+/**
+ * @description ๋ด ํ๋กํ ์ ๋ณด ์กฐํ ์๋ต
+ */
export type UserProfile =
paths['/users/info']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ๋ด ๋ณดํ ์์ฝ ์ ๋ณด ์๋ต
+ */
export type ReportSummaryRes =
paths['/users/me/report-summary']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ์ง์
์ ๋ณด ๋ชฉ๋ก ์๋ต
+ */
export type UserInfoJobs =
paths['/user-infos/jobs']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ์ง๋จ๋ฐ์ ์ง๋ณ ์ ๋ณด ๋ชฉ๋ก ์๋ต
+ */
export type UserInfoDiseases =
paths['/user-infos/diagnosed-disease']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ์ ํ๋ ๋ณด์ฅ ์ ๋ณด ๋ชฉ๋ก ์๋ต
+ */
export type UserInfoCoverages =
paths['/user-infos/coverage-select']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ๋ณดํ ๋ฆฌํฌํธ ์ ์ถ ์์ฒญ ๋ฐ๋
+ */
export type UserInfoSubmitRequest =
paths['/insurances/reports']['post']['requestBody']['content']['application/json'];
+/**
+ * @description ๋ณดํ ๋ฆฌํฌํธ ์ ์ถ ์ฑ๊ณต ์๋ต
+ */
export type UserInfoSubmitResponse =
paths['/insurances/reports']['post']['responses']['200']['content']['*/*'];
-// INSURANCE
+/* =======================================================
+ * ๐ INSURANCE ๊ด๋ จ ํ์
+ * ======================================================= */
+
+/**
+ * @description ํน์ ๋ณดํ ๋ฆฌํฌํธ ์์ธ ์กฐํ ์๋ต
+ */
export type InsuranceReport =
paths['/insurances/reports/{insurance-report-id}']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ๋ด ๋ณดํ ์์ฝ ๋ฐ์ดํฐ (ReportSummaryRes์ data ํ๋)
+ */
export type InsuranceSummary =
paths['/users/me/report-summary']['get']['responses']['200']['content']['*/*']['data'];
+/**
+ * @description ์ฃผ์ ์ง๋ณ ๋ณด์ฅ ๋ฆฌํฌํธ ์๋ต
+ */
export type InsuranceKeunbyeongReport =
paths['/insurances/reports/{insurance-report-id}/major-disease']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ์์ ๋ณด์ฅ ๋ฆฌํฌํธ ์๋ต
+ */
export type InsuranceSusulReport =
paths['/insurances/reports/{insurance-report-id}/surgery']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ์
์ ๋ณด์ฅ ๋ฆฌํฌํธ ์๋ต
+ */
export type InsuranceIpwonReport =
paths['/insurances/reports/{insurance-report-id}/hospitalization']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ์ฅํด(์ฅ์ ) ๋ณด์ฅ ๋ฆฌํฌํธ ์๋ต
+ */
export type InsuranceJanghaeReport =
paths['/insurances/reports/{insurance-report-id}/disability']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ์ฌ๋ง ๋ณด์ฅ ๋ฆฌํฌํธ ์๋ต
+ */
export type InsuranceSamangReport =
paths['/insurances/reports/{insurance-report-id}/death']['get']['responses']['200']['content']['*/*'];
-// COMMUNITY
+/* =======================================================
+ * ๐ COMMUNITY ๊ด๋ จ ํ์
+ * ======================================================= */
+
+/**
+ * @description ํผ๋ ์์ฑ ์ฑ๊ณต ์๋ต
+ */
export type FeedResponse =
paths['/posts']['post']['responses']['200']['content'];
+/**
+ * @description ํผ๋ ์์ฑ ์์ฒญ ๋ฐ๋
+ */
export type FeedRequest =
paths['/posts']['post']['requestBody']['content']['application/json'];
-// --- me post
+/**
+ * @description ๋ด ํผ๋ ๋ชฉ๋ก ์กฐํ ์๋ต
+ */
export type MePostResponse =
paths['/users/me/posts']['get']['responses']['200']['content']['*/*'];
+
+/**
+ * @description ๋ด ํผ๋ ๋ชฉ๋ก ์กฐํ ์ฟผ๋ฆฌ ํ๋ผ๋ฏธํฐ
+ */
export type MePostRequest =
paths['/users/me/posts']['get']['parameters']['query'];
+/**
+ * @description ๋๊ธ ์์ฑ ์ฑ๊ณต ์๋ต
+ */
export type CommentPostResponse =
paths['/posts/{post-id}/comments']['post']['responses']['200']['content'];
+/**
+ * @description ๋๊ธ ์์ฑ ์์ฒญ ๋ฐ๋
+ */
export type CommentPostRequest =
paths['/posts/{post-id}/comments']['post']['requestBody']['content']['application/json'];
+/**
+ * @description ํผ๋ ์์ธ ์กฐํ ์๋ต
+ */
export type FeedDetailResponse =
paths['/posts/{post-id}']['get']['responses']['200']['content']['*/*']['data'];
+/**
+ * @description ํผ๋ ๋ชฉ๋ก(ํ๋ฆฌ๋ทฐ) ์กฐํ ์๋ต
+ */
export type FeedPreviewResponse =
paths['/posts']['get']['responses']['200']['content']['*/*']['data'];
+/**
+ * @description ๋๊ธ ๋ชฉ๋ก ์กฐํ ์๋ต
+ */
export type CommentResponse =
paths['/posts/{post-id}/comments']['get']['responses']['200']['content']['*/*'];
+/**
+ * @description ๋๊ธ ๋ชฉ๋ก ์กฐํ ์ฟผ๋ฆฌ ํ๋ผ๋ฏธํฐ
+ */
export type CommentRequest =
paths['/posts/{post-id}/comments']['get']['parameters']['query'];
+/**
+ * @description ๋๊ธ ์ญ์ ์ฑ๊ณต ์๋ต
+ */
export type CommentDeleteResponse =
paths['/posts/{post-id}/comments/{comment-id}']['delete']['responses']['200']['content']['*/*'];
+/**
+ * @description ํผ๋ ์์ ์์ฒญ ๊ฒฝ๋ก ํ๋ผ๋ฏธํฐ
+ */
export type FeedUpdateResponse =
paths['/posts/{post-id}']['put']['parameters']['path'];
+/**
+ * @description ํผ๋ ์์ ์์ฒญ ๋ฐ๋
+ */
export type FeedUpdateRequestBody =
paths['/posts/{post-id}']['put']['requestBody']['content']['application/json'];
+/**
+ * @description ํผ๋ ์ญ์ ์ฑ๊ณต ์๋ต
+ */
export type FeedDeleteResponse =
paths['/posts/{post-id}']['delete']['responses']['200']['content']['*/*'];
diff --git a/apps/client/src/shared/configs/app-config.ts b/apps/client/src/shared/configs/app-config.ts
index a88fe1c7..e1042c63 100644
--- a/apps/client/src/shared/configs/app-config.ts
+++ b/apps/client/src/shared/configs/app-config.ts
@@ -1,21 +1,18 @@
-import { routePath } from '@shared/router/path.ts';
-
+import { routePath } from '@shared/router/path';
/**
* ์ ํ๋ฆฌ์ผ์ด์
์ ์ฒด ์ค์ ์ ๊ด๋ฆฌํ๋ Config ํ์ผ
*/
const DEFAULT_CONFIG = {
auth: {
isEnabled: true, // ์ธ์ฆ ๊ธฐ๋ฅ ํ์ฑํ ์ฌ๋ถ
-
loginSuccessUrl: routePath.LOGIN_FALLBACK,
loginFailureUrl: routePath.LOGIN,
-
kakaoLoginUrl: import.meta.env.VITE_KAKAO_LOGIN_URL || '',
+ kakaoLocalRedirectUrl: import.meta.env.VITE_KAKAO_LOCAL_REDIRECT_URI || '',
+ kakaoProdRedirectUrl: import.meta.env.VITE_KAKAO_PROD_REDIRECT_URI || '',
},
-
api: {
baseUrl: import.meta.env.VITE_API_BASE_URL,
- kakaoRedirectUrl: import.meta.env.VITE_KAKAO_REDIRECT_URI,
},
};
diff --git a/apps/client/src/widgets/login/components/login-slide/kakao-login-button.tsx b/apps/client/src/widgets/login/components/login-slide/kakao-login-button.tsx
index 8f025758..437feee5 100644
--- a/apps/client/src/widgets/login/components/login-slide/kakao-login-button.tsx
+++ b/apps/client/src/widgets/login/components/login-slide/kakao-login-button.tsx
@@ -1,14 +1,23 @@
import { Icon } from '@bds/ui/icons';
+import { appConfig } from '@shared/configs/app-config';
+
import * as styles from './kakao-login-button.css';
const KakaoLoginButton = () => {
- const handleStartLogin = () => {
- window.location.href = import.meta.env.VITE_KAKAO_REDIRECT_URI;
+ const handleKakaoLogin = () => {
+ const redirectUri =
+ window.location.hostname === 'localhost'
+ ? appConfig.auth.kakaoLocalRedirectUrl
+ : appConfig.auth.kakaoProdRedirectUrl;
+
+ const loginUrl = `${appConfig.auth.kakaoLoginUrl}&redirect_uri=${encodeURIComponent(redirectUri)}`;
+
+ window.location.href = loginUrl;
};
return (
-
+
์นด์นด์คํก์ผ๋ก ์์ํ๊ธฐ
diff --git a/apps/client/src/widgets/login/components/login-slide/login-slide.tsx b/apps/client/src/widgets/login/components/login-slide/login-slide.tsx
index 4872b400..8d6370b5 100644
--- a/apps/client/src/widgets/login/components/login-slide/login-slide.tsx
+++ b/apps/client/src/widgets/login/components/login-slide/login-slide.tsx
@@ -24,7 +24,6 @@ const LoginSlide = () => {
{
} = useInfiniteQuery({
...USER_QUERY_OPTIONS.ME_POSTS(),
enabled: activeTab === PREVIEW_TABS.POSTS,
- getNextPageParam: (lastPage) =>
- lastPage.isLast ? undefined : lastPage.nextCursor,
- initialPageParam: 0,
});
const {
@@ -47,9 +44,6 @@ const Preview = () => {
} = useInfiniteQuery({
...USER_QUERY_OPTIONS.ME_COMMENTS(),
enabled: activeTab === PREVIEW_TABS.COMMENTS,
- getNextPageParam: (lastPage) =>
- lastPage.isLast ? undefined : lastPage.nextCursor,
- initialPageParam: 0,
});
const posts = postData?.pages.flatMap((page) => page.content ?? []) ?? [];
diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts
index 57426e39..1100fc86 100644
--- a/apps/client/vite.config.ts
+++ b/apps/client/vite.config.ts
@@ -15,6 +15,14 @@ export default defineConfig({
iconDirs: [resolve(__dirname, '../../packages/bds-ui/src/icons')],
symbolId: 'icon-[name]',
inject: 'body-last',
+ svgoConfig: {
+ plugins: [
+ {
+ name: 'removeDimensions',
+ active: true,
+ },
+ ],
+ },
}),
],
server: {
diff --git a/package.json b/package.json
index 87c92541..5c00a935 100644
--- a/package.json
+++ b/package.json
@@ -11,13 +11,17 @@
"preview": "vite preview",
"prettier": "prettier --write .",
"type-check": "tsc --noEmit -p ./tsconfig.json",
- "commitlint-wrapper": "sh ./scripts/commitlint-wrapper.sh"
+ "commitlint-wrapper": "sh ./scripts/commitlint-wrapper.sh",
+ "changeset": "changeset",
+ "version": "changeset version",
+ "release": "pnpm build && changeset publish"
},
"dependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
"devDependencies": {
+ "@changesets/cli": "^2.29.5",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@types/react": "^19.1.8",
diff --git a/packages/bds-ui/CHANGELOG.md b/packages/bds-ui/CHANGELOG.md
new file mode 100644
index 00000000..9b325191
--- /dev/null
+++ b/packages/bds-ui/CHANGELOG.md
@@ -0,0 +1,11 @@
+# @bds/ui
+
+## 1.0.0
+
+### Major Changes
+
+- 5ec8413: first version control
+
+### Patch Changes
+
+- b887609: init version control
diff --git a/packages/bds-ui/package.json b/packages/bds-ui/package.json
index 6e083388..ee3a6bf1 100644
--- a/packages/bds-ui/package.json
+++ b/packages/bds-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "@bds/ui",
- "version": "0.1.0",
+ "version": "1.0.0",
"private": true,
"exports": {
".": "./src/components/index.ts",
diff --git a/packages/bds-ui/src/icons/assets/3d_brain.svg b/packages/bds-ui/src/icons/assets/3d_brain.svg
index b3f6b652..80f4453b 100644
--- a/packages/bds-ui/src/icons/assets/3d_brain.svg
+++ b/packages/bds-ui/src/icons/assets/3d_brain.svg
@@ -1,4 +1,4 @@
-