Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const App = () => {
path='/clubDetail/:clubId'
element={<ClubDetailPage />}
/>
{/*한국어핸들 */}
<Route
path='/clubDetail/@:clubName'
element={<ClubDetailPage />}
/>
Comment on lines +58 to +62
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@핸들을 적용한 이유가 궁금합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

라우팅 구분자가 필요해서 사용하였습니다

{/*새로 빌드해서 배포할 앱 주소 url*/}
<Route
path='/webview/club/:clubId'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants/queryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const queryKeys = {
},
club: {
all: ['clubs'] as const,
detail: (clubId: string) => ['clubDetail', clubId] as const,
detail: (clubParam: string) => ['clubDetail', clubParam] as const,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

구조변경에 맞게 clubParam 네이밍 변경좋습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 clubParam 변수명뭔가 애매쓰 추천받습니다

list: (
keyword: string,
recruitmentStatus: string,
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/hooks/Queries/useClub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ interface UseGetCardListProps {
division: string;
}

export const useGetClubDetail = (clubId: string) => {
export const useGetClubDetail = (clubParam: string) => {
return useQuery<ClubDetail>({
queryKey: queryKeys.club.detail(clubId),
queryFn: () => getClubDetail(clubId as string),
queryKey: queryKeys.club.detail(clubParam),
queryFn: () => getClubDetail(clubParam as string),
staleTime: 60 * 1000,
enabled: !!clubId,
enabled: !!clubParam,
select: (data) =>
({
...data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ const ApplicationFormPage = () => {
if (isLoading) return <Spinner />;
if (isError || clubError) {
alert(applicationError?.message || '문제가 발생했어요.');
navigate(`/clubDetail/${clubId}`);
if (clubDetail?.name) {
navigate(`/clubDetail/@${clubDetail?.name}`);
} else {
navigate(`/`);
}
return null;
}
if (!formData || !clubDetail || !formData.questions) {
Expand Down Expand Up @@ -111,7 +115,7 @@ const ApplicationFormPage = () => {
alert(
`"${clubDetail.name}" 동아리에 성공적으로 지원되었습니다.\n좋은 결과 있으시길 바랍니다`,
);
navigate(`/clubDetail/${clubId}`, { replace: true });
navigate(`/clubDetail/@${clubDetail.name}`, { replace: true });
} catch (error) {
alert(
'답변 제출에 실패했어요.\n네트워크 상태를 확인하거나 잠시 후 다시 시도해 주세요.',
Expand Down
9 changes: 7 additions & 2 deletions frontend/src/pages/ClubDetailPage/ClubDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ const ClubDetailPage = () => {
? tabParam
: TAB_TYPE.INTRO;

const { clubId } = useParams<{ clubId: string }>();
const { clubId, clubName } = useParams<{
clubId: string;
clubName: string;
}>();
const { isMobile, isTablet, isLaptop, isDesktop } = useDevice();
const showTopBar = isMobile || isTablet;

const { data: clubDetail, error } = useGetClubDetail(clubId || '');
const { data: clubDetail, error } = useGetClubDetail(
(clubName ?? clubId) || '',
);

useTrackPageView(PAGE_VIEW.CLUB_DETAIL_PAGE, clubDetail?.name, !clubDetail);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ClubCard = ({ club }: { club: Club }) => {

setTimeout(() => {
setIsClicked(false);
navigate(`/clubDetail/${club.id}`);
navigate(`/clubDetail/@${club.name}`);
}, 150);
};

Expand Down
Loading