diff --git a/src/pages/admin/UserManagement.tsx b/src/pages/admin/UserManagement.tsx
index d417a05c..43ef264e 100644
--- a/src/pages/admin/UserManagement.tsx
+++ b/src/pages/admin/UserManagement.tsx
@@ -126,7 +126,7 @@ export default function UserManagement() {
}
handleChangeTab(type);
}}
- tabClassName="!p-3"
+ tabClassName="!p-3 !px-4"
/>
diff --git a/src/pages/admin/UserManagementDetail.tsx b/src/pages/admin/UserManagementDetail.tsx
index 2b0748b3..71e2e6f6 100644
--- a/src/pages/admin/UserManagementDetail.tsx
+++ b/src/pages/admin/UserManagementDetail.tsx
@@ -245,7 +245,12 @@ export default function UserManagementDetail() {
)}
{'job' in data && (
- {data.job}
+
)}
{'techStack' in data && (
diff --git a/src/pages/admin/UserPostCollection.tsx b/src/pages/admin/UserPostCollection.tsx
index 33b7e144..52a2aa5e 100644
--- a/src/pages/admin/UserPostCollection.tsx
+++ b/src/pages/admin/UserPostCollection.tsx
@@ -53,7 +53,7 @@ export default function UserPostCollection({
const initialFilter: MyPostDto.GetPostListParams = {
page: 1,
size: 5,
- // order: 'latest',
+ sort: 'updated_At,DESC',
};
const {
diff --git a/src/pages/trainee/AppliedSessionsDetail.tsx b/src/pages/trainee/AppliedSessionsDetail.tsx
index 0c6945b4..48c40a1f 100644
--- a/src/pages/trainee/AppliedSessionsDetail.tsx
+++ b/src/pages/trainee/AppliedSessionsDetail.tsx
@@ -38,7 +38,7 @@ export default function AppliedSessionsDetail() {
{!isLoading &&
(myAppliedSessionList?.length === 0 ? (
) : (
diff --git a/src/pages/trainee/Lounge.tsx b/src/pages/trainee/Lounge.tsx
index 002307b1..4e98553d 100644
--- a/src/pages/trainee/Lounge.tsx
+++ b/src/pages/trainee/Lounge.tsx
@@ -150,20 +150,21 @@ export default function Lounge() {
-
- {projects.map(project => (
- -
-
-
+ {!isLoading &&
+ (projects.length === 0 ? (
+
+ ) : (
+
+ {projects.map(project => (
+ -
+
+
+ ))}
+
))}
-
-
- {projects.length === 0 && !isLoading && (
-
- )}
{isLoading && (
diff --git a/src/pages/trainee/LoungeDetail.tsx b/src/pages/trainee/LoungeDetail.tsx
index a687545b..b93c8321 100644
--- a/src/pages/trainee/LoungeDetail.tsx
+++ b/src/pages/trainee/LoungeDetail.tsx
@@ -68,58 +68,57 @@ export default function LoungeDetail() {
const postWriter = userProfile?.nickname === postDetail?.writerNickName;
- return (
-
-
-
-
- {!isPostDetailLoading ? (
-
-
- {postDetail?.title}
-
-
-
-
- {postDetail && (
-
- )}
-
-
- ) : (
-
-
-
+ return isPostDetailLoading ? (
+
+
+
+ ) : (
+ <>
+
+ navigate('/lounge')} />
+
+
+ {postDetail?.title}
+
+
+
+
+
+ {postDetail && (
+
)}
-
-
-
+
+
+
+
+ >
);
}
diff --git a/src/pages/trainee/NoticeDetail.tsx b/src/pages/trainee/NoticeDetail.tsx
index f0c34f5d..9bcc670a 100644
--- a/src/pages/trainee/NoticeDetail.tsx
+++ b/src/pages/trainee/NoticeDetail.tsx
@@ -152,8 +152,6 @@ export default function NoticeDetail() {
userProfile.userId,
]);
- const onBackClick = () => navigate('/notice');
-
const { alert, hideDialog } = useDialogContext();
useEffect(() => {
@@ -169,88 +167,82 @@ export default function NoticeDetail() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [error]);
- return (
-
-
-
- {isNoticeDetailLoading ? (
-
-
-
- ) : (
-
-
-
-
- {noticeDetail?.title || '-'}
-
-
-
-
-
- {noticeDetail?.writer?.role && (
-
- )}
- {noticeDetail?.noticeType && (
-
- )}
- {noticeDetail?.writer?.userId === userProfile?.userId && (
-
-
-
-
-
- {actions.map(action => (
- -
-
-
- ))}
-
-
-
- )}
-
-
- {noticeDetail?.noticeType &&
- findCurrNotice(noticeDetail?.noticeType)?.needExtraInfo && (
-
- )}
-
-
+
+
+ ) : (
+ <>
+
+ navigate('/notice')} />
+
+
+ {noticeDetail?.title}
+
+
+
+
+ {noticeDetail?.writer?.role && (
+
-
-
-
+ )}
+ {noticeDetail?.noticeType && (
+
+ )}
+ {noticeDetail?.writer?.userId === userProfile?.userId && (
+
+
+
+
+
+ {actions.map(action => (
+ -
+
+
+ ))}
+
+
+
+ )}
- )}
-
+
+ {noticeDetail?.noticeType &&
+ findCurrNotice(noticeDetail?.noticeType)?.needExtraInfo && (
+
+ )}
+
+
+
+
+
+ >
);
}
diff --git a/src/pages/trainee/Schedule.tsx b/src/pages/trainee/Schedule.tsx
index 6658809e..c5591c80 100644
--- a/src/pages/trainee/Schedule.tsx
+++ b/src/pages/trainee/Schedule.tsx
@@ -27,7 +27,7 @@ export default function Schedule() {
{!isCalendarDataLoading && !isCourseCalendarStatusLoading && (
diff --git a/src/services/auth/authQueries.ts b/src/services/auth/authQueries.ts
index 2490b725..3e5fadb2 100644
--- a/src/services/auth/authQueries.ts
+++ b/src/services/auth/authQueries.ts
@@ -4,6 +4,7 @@ import { axiosInstance } from '@/services/axiosInstance';
import { CALENDAR_TOKEN_KEY } from '@/constants';
import { UserProfileDto } from '@/types';
+import { AxiosError } from 'axios';
// 로그인 검증
export const loginCheck = () => axiosInstance.get('/login/check');
@@ -20,12 +21,19 @@ export const getVerifyNicknameResult = (nickname: string) =>
// 캘린더 인증
export const getCalendarToken = () =>
- axiosInstance.get('/user/calendar').then(res => {
- const calendarAccessToken = res.data.access_token;
- if (calendarAccessToken) {
- sessionStorage.setItem(CALENDAR_TOKEN_KEY, calendarAccessToken);
- }
- });
+ axiosInstance
+ .get('/user/calendar')
+ .then(res => {
+ const calendarAccessToken = res.data.access_token;
+ if (calendarAccessToken) {
+ sessionStorage.setItem(CALENDAR_TOKEN_KEY, calendarAccessToken);
+ }
+ })
+ .catch((err: AxiosError) => {
+ if (err.response?.status === 400) {
+ window.location.href = `${import.meta.env.VITE_SERVER_API_URL}/oauth2/authorization/google`;
+ }
+ });
// 리프레시 토큰
export const getNewAccessToken = () =>
diff --git a/src/services/post/loungeMutations.ts b/src/services/post/loungeMutations.ts
deleted file mode 100644
index 86152af7..00000000
--- a/src/services/post/loungeMutations.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { useMutation } from '@tanstack/react-query';
-
-import { axiosInstance } from '@/services/axiosInstance';
-
-import { AxiosError } from 'axios';
-
-export const usePostIncrementViewCount = () => {
- return useMutation({
- mutationFn: async requestParams => {
- const { data } = await axiosInstance.post(
- `/project/${requestParams.projectId}/view`,
- );
- return data;
- },
- });
-};
-
-export const usePostScrapProject = () => {
- return useMutation({
- mutationFn: async requestParams => {
- const { data } = await axiosInstance.post(
- `/project/${requestParams.projectId}/scrap`,
- );
- return data;
- },
- });
-};
diff --git a/src/services/post/noticeMutations.ts b/src/services/post/noticeMutations.ts
index 18a28e6b..3eff3b13 100644
--- a/src/services/post/noticeMutations.ts
+++ b/src/services/post/noticeMutations.ts
@@ -26,12 +26,3 @@ export const usePatchNoticeStatus = (
...options,
});
};
-
-export const useNoticeIncrementViewCount = () => {
- return useMutation({
- mutationFn: async ({ noticeId }: { noticeId: number }) => {
- const { data } = await axiosInstance.post(`/notices/${noticeId}/view`);
- return data;
- },
- });
-};
diff --git a/src/services/post/postMutation.ts b/src/services/post/postMutation.ts
index b4158878..84d28537 100644
--- a/src/services/post/postMutation.ts
+++ b/src/services/post/postMutation.ts
@@ -79,3 +79,15 @@ export const useDeleteAllScrap = (
...options,
});
};
+
+/** 포스트 뷰 증가 API */
+export const usePostAddViewCount = (postType: 'project' | 'notices') => {
+ return useMutation({
+ mutationFn: async requestParams => {
+ const { data } = await axiosInstance.post(
+ `/${postType}/${requestParams.linkedId}/view`,
+ );
+ return data;
+ },
+ });
+};
diff --git a/src/services/store/storeMutations.ts b/src/services/store/storeMutations.ts
index d366e57c..1d2917bd 100644
--- a/src/services/store/storeMutations.ts
+++ b/src/services/store/storeMutations.ts
@@ -64,7 +64,7 @@ export const usePostMeal = () => {
});
};
-export const usePutMealPost = () => {
+export const usePutMealParticipate = () => {
return useMutation({
mutationFn: async requestBody => {
const { data } = await axiosInstance.put(
@@ -85,12 +85,10 @@ export const usePutMealPostLeave = () => {
});
};
-export const usePutMealPostDelete = () => {
+export const useDeleteMealPost = () => {
return useMutation({
- mutationFn: async requestBody => {
- const { data } = await axiosInstance.delete(`/mealPost`, {
- data: requestBody,
- });
+ mutationFn: async ({ mealPostId }: { mealPostId: number }) => {
+ const { data } = await axiosInstance.delete(`/mealPost/${mealPostId}`);
return data;
},
});
diff --git a/src/services/store/storeQueries.ts b/src/services/store/storeQueries.ts
index 023efc0c..8693d083 100644
--- a/src/services/store/storeQueries.ts
+++ b/src/services/store/storeQueries.ts
@@ -15,7 +15,11 @@ import {
} from '@/types/store/storeMealPostDto';
import { extractValidParams } from '@/utils';
-export const useGetInfiniteStoreList = () => {
+export const useGetInfiniteStoreList = ({
+ userCampusId,
+}: {
+ userCampusId?: number;
+}) => {
const [searchParams] = useSearchParams();
const newSearchParams = extractValidParams(searchParams);
const pageSize = 10;
@@ -28,7 +32,7 @@ export const useGetInfiniteStoreList = () => {
{
params: {
page: pageParam,
- campusId: newSearchParams.campusId || 1,
+ campusId: newSearchParams.campusId || userCampusId,
...newSearchParams,
size: pageSize,
},
@@ -39,12 +43,13 @@ export const useGetInfiniteStoreList = () => {
nextPage: data.stores.length === pageSize ? pageParam + 1 : undefined,
};
},
+ enabled: !!userCampusId,
getNextPageParam: lastPage => lastPage.nextPage,
initialPageParam: 0,
});
};
-export const useGetFilterCount = (campusId: number) => {
+export const useGetFilterCount = (campusId?: number) => {
return useQuery({
queryKey: ['useGetFilterCount', campusId],
queryFn: async () => {
diff --git a/src/types/mypage/myPostDto.d.ts b/src/types/mypage/myPostDto.d.ts
index 6a7ed916..aea0fb6c 100644
--- a/src/types/mypage/myPostDto.d.ts
+++ b/src/types/mypage/myPostDto.d.ts
@@ -13,7 +13,7 @@ export namespace MyPostDto {
export type GetCommentList = Pageable & { content: UserComment[] };
export type GetPostListParams = PaginationFilter &
- SortPostTypeFilter & { order?: 'latest' | 'oldest' };
+ SortPostTypeFilter & { sort?: 'updated_At,DESC' | 'updated_At,ASC' };
}
type UserScrap = {
@@ -24,6 +24,7 @@ type UserScrap = {
profileImg: string;
};
postId: number;
+ linkedId: number;
title: string;
postType: PostTypeKey;
content: string;
@@ -47,6 +48,7 @@ type UserComment = {
commentId: number;
userNickname: string;
postId: number;
+ linkedId: number;
content: string;
createdAt: string;
postType: PostTypeKey;