From 30f0983b195510e5aad591b207bf64de9a02b3cf Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 18:35:16 +0900 Subject: [PATCH 01/15] =?UTF-8?q?feat:addBaseUrl=EC=97=90=EC=84=9C=20/?= =?UTF-8?q?=EB=A5=BC=20=EC=9E=90=EB=8F=99=EC=9C=BC=EB=A1=9C=20=EB=84=A3?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/apis/apiClient.ts | 1 - frontend/src/apis/deletes.ts | 2 +- frontend/src/apis/gets.ts | 37 ++++++++++++++++++++-------------- frontend/src/apis/patches.ts | 10 ++++----- frontend/src/apis/posts.ts | 28 ++++++++++++------------- 5 files changed, 42 insertions(+), 36 deletions(-) diff --git a/frontend/src/apis/apiClient.ts b/frontend/src/apis/apiClient.ts index acfb2a558..6022682f5 100644 --- a/frontend/src/apis/apiClient.ts +++ b/frontend/src/apis/apiClient.ts @@ -11,7 +11,6 @@ const DEFAULT_HEADERS = { const BASE_URL = `${process.env.BASE_URL}/v1`; function addBaseUrl(endpoint: string, isNeedLastDarakbang: boolean = false) { - if (endpoint[0] !== '/') endpoint = '/' + endpoint; if (isNeedLastDarakbang) endpoint = '/darakbang/' + (getLastDarakbangId() || 0) + endpoint; return BASE_URL + endpoint; diff --git a/frontend/src/apis/deletes.ts b/frontend/src/apis/deletes.ts index 08ab3af5d..9126fbd0e 100644 --- a/frontend/src/apis/deletes.ts +++ b/frontend/src/apis/deletes.ts @@ -1,7 +1,7 @@ import ApiClient from './apiClient'; export const deleteCancelChamyo = async (moimId: number) => { - await ApiClient.deleteWithLastDarakbangId(`chamyo`, { + await ApiClient.deleteWithLastDarakbangId(`/chamyo`, { moimId, }); }; diff --git a/frontend/src/apis/gets.ts b/frontend/src/apis/gets.ts index b9d54fa6c..91f7f71a1 100644 --- a/frontend/src/apis/gets.ts +++ b/frontend/src/apis/gets.ts @@ -27,7 +27,7 @@ import ApiClient from './apiClient'; import { Filter } from '@_components/MyMoimListFilters/MyMoimListFilters'; export const getMoims = async (): Promise => { - const response = await ApiClient.getWithLastDarakbangId('moim'); + const response = await ApiClient.getWithLastDarakbangId('/moim'); const json: GetMoims = await response.json(); return json.data.moims; @@ -37,7 +37,7 @@ export const getMyFilteredMoims = async ( filter: Filter['api'], ): Promise => { const response = await ApiClient.getWithLastDarakbangId( - `moim/mine?filter=${filter}`, + `/moim/mine?filter=${filter}`, ); const json: GetMoims = await response.json(); @@ -45,21 +45,21 @@ export const getMyFilteredMoims = async ( }; export const getMyZzimMoims = async (): Promise => { - const response = await ApiClient.getWithLastDarakbangId('moim/zzim'); + const response = await ApiClient.getWithLastDarakbangId('/moim/zzim'); const json: GetMoims = await response.json(); return json.data.moims; }; export const getMoim = async (moimId: number): Promise => { - const response = await ApiClient.getWithLastDarakbangId(`moim/${moimId}`); + const response = await ApiClient.getWithLastDarakbangId(`/moim/${moimId}`); const json: GetMoim = await response.json(); return json.data; }; export const getChatPreview = async (): Promise => { - const response = await ApiClient.getWithLastDarakbangId(`chat/preview`); + const response = await ApiClient.getWithLastDarakbangId(`/chat/preview`); const json: GetChattingPreview = await response.json(); return json.data.chatPreviewResponses; @@ -70,7 +70,7 @@ export const getChat = async ( recentChatId?: number, ): Promise => { const response = await ApiClient.getWithLastDarakbangId( - `chat?moimId=${moimId}&recentChatId=${recentChatId || 0}`, + `/chat?moimId=${moimId}&recentChatId=${recentChatId || 0}`, ); const json: GetChat = await response.json(); @@ -78,7 +78,7 @@ export const getChat = async ( }; export const getMyMoims = async (): Promise => { - const response = await ApiClient.getWithLastDarakbangId(`moim/mine`); + const response = await ApiClient.getWithLastDarakbangId(`/moim/mine`); const json: GetMoims = await response.json(); return json.data.moims; @@ -86,7 +86,7 @@ export const getMyMoims = async (): Promise => { export const getChamyoMine = async (moimId: number): Promise => { const response = await ApiClient.getWithLastDarakbangId( - `chamyo/mine?moimId=${moimId}`, + `/chamyo/mine?moimId=${moimId}`, ); const json: GetChamyoMine = await response.json(); @@ -95,7 +95,7 @@ export const getChamyoMine = async (moimId: number): Promise => { export const getZzimMine = async (moimId: number): Promise => { const response = await ApiClient.getWithLastDarakbangId( - `zzim/mine?moimId=${moimId}`, + `/zzim/mine?moimId=${moimId}`, ); const json: GetZzimMine = await response.json(); @@ -106,7 +106,7 @@ export const getChamyoAll = async ( moimId: number, ): Promise => { const response = await ApiClient.getWithLastDarakbangId( - `chamyo/all?moimId=${moimId}`, + `/chamyo/all?moimId=${moimId}`, ); const json: GetChamyoAll = await response.json(); @@ -114,28 +114,28 @@ export const getChamyoAll = async ( }; export const getPleases = async () => { - const response = await ApiClient.getWithLastDarakbangId('please'); + const response = await ApiClient.getWithLastDarakbangId('/please'); const json: GetPleases = await response.json(); return json.data.pleases; }; export const getMyInfo = async () => { - const response = await ApiClient.getWithLastDarakbangId('member/mine'); + const response = await ApiClient.getWithLastDarakbangId('/member/mine'); const json: GetMyInfo = await response.json(); return json.data; }; export const getNotifications = async () => { - const response = await ApiClient.getWithLastDarakbangId('notification/mine'); + const response = await ApiClient.getWithLastDarakbangId('/notification/mine'); const json: GetNotifications = await response.json(); return json.data.notifications; }; export const getMyDarakbangs = async () => { - const response = await ApiClient.getWithAuth('darakbang/mine'); + const response = await ApiClient.getWithAuth('/darakbang/mine'); const json: GetDarakbangMine = await response.json(); return json.data.darakbangResponses; @@ -164,7 +164,7 @@ export const getDarakbangInviteCode = async () => { export const getDarakbangNameByCode = async (code: string) => { const response = await ApiClient.getWithAuth( - 'darakbang/validation?code=' + code, + '/darakbang/validation?code=' + code, ).catch(() => { return { json: () => { @@ -176,3 +176,10 @@ export const getDarakbangNameByCode = async (code: string) => { const json: GetDarakbangNameByCode = await response.json(); return json.data.name; }; + +export const getDarakbangNameById = async () => { + const response = await ApiClient.getWithLastDarakbangId(''); + + const json: GetDarakbangNameByCode = await response.json(); + return json.data.name; +}; diff --git a/frontend/src/apis/patches.ts b/frontend/src/apis/patches.ts index 5d01f1ad7..f7930b6c8 100644 --- a/frontend/src/apis/patches.ts +++ b/frontend/src/apis/patches.ts @@ -3,13 +3,13 @@ import { MoimInputInfo } from '@_types/index'; import { PostMoimBody } from './responseTypes'; export const patchCompleteMoim = async (moimId: number) => { - await ApiClient.patchWithLastDarakbangId(`moim/${moimId}/complete`, { + await ApiClient.patchWithLastDarakbangId(`/moim/${moimId}/complete`, { moimId, }); }; export const patchCancelMoim = async (moimId: number) => { - await ApiClient.patchWithLastDarakbangId(`moim/${moimId}/cancel`, { + await ApiClient.patchWithLastDarakbangId(`/moim/${moimId}/cancel`, { moimId, }); }; @@ -22,18 +22,18 @@ export const patchModifyMoim = async (moimId: number, moim: MoimInputInfo) => { place: moim.place || undefined, }; - await ApiClient.patchWithLastDarakbangId(`moim`, { + await ApiClient.patchWithLastDarakbangId(`/moim`, { moimId, ...parsedMoim, }); }; export const patchReopenMoim = async (moimId: number) => { - await ApiClient.patchWithLastDarakbangId(`moim/${moimId}/reopen`, { + await ApiClient.patchWithLastDarakbangId(`/moim/${moimId}/reopen`, { moimId, }); }; export const patchOpenChat = async (moimId: number) => { - await ApiClient.patchWithLastDarakbangId(`chat/open?moimId=${moimId}`); + await ApiClient.patchWithLastDarakbangId(`/chat/open?moimId=${moimId}`); }; diff --git a/frontend/src/apis/posts.ts b/frontend/src/apis/posts.ts index 98db1ebf3..aaf975d18 100644 --- a/frontend/src/apis/posts.ts +++ b/frontend/src/apis/posts.ts @@ -11,20 +11,20 @@ export const postMoim = async (moim: MoimInputInfo): Promise => { place: moim.place || undefined, }; - const response = await ApiClient.postWithLastDarakbangId('moim', parsedMoim); + const response = await ApiClient.postWithLastDarakbangId('/moim', parsedMoim); const json: PostMoim = await response.json(); return json.data; }; export const postJoinMoim = async (moimId: number) => { - await ApiClient.postWithLastDarakbangId('chamyo', { + await ApiClient.postWithLastDarakbangId('/chamyo', { moimId, }); }; export const postChangeZzim = async (moimId: number) => { - await ApiClient.postWithLastDarakbangId('zzim', { + await ApiClient.postWithLastDarakbangId('/zzim', { moimId, }); }; @@ -34,11 +34,11 @@ export const postWriteComment = async ( message: string, ) => { if (selectedComment === 0) { - await ApiClient.postWithLastDarakbangId(`moim/${moimId}`, { + await ApiClient.postWithLastDarakbangId(`/moim/${moimId}`, { content: message, }); } else { - await ApiClient.postWithLastDarakbangId(`moim/${moimId}`, { + await ApiClient.postWithLastDarakbangId(`/moim/${moimId}`, { parentId: selectedComment, content: message, }); @@ -46,14 +46,14 @@ export const postWriteComment = async ( }; export const postChat = async (moimId: number, content: string) => { - await ApiClient.postWithLastDarakbangId('chat', { + await ApiClient.postWithLastDarakbangId('/chat', { moimId, content, }); }; export const postInterest = async (pleaseId: number, isInterested: boolean) => { - await ApiClient.postWithLastDarakbangId('interest', { + await ApiClient.postWithLastDarakbangId('/interest', { pleaseId, isInterested, }); @@ -62,7 +62,7 @@ export const postLastReadChatId = async ( moimId: number, lastReadChatId: number, ) => { - await ApiClient.postWithLastDarakbangId('chat/last', { + await ApiClient.postWithLastDarakbangId('/chat/last', { moimId, lastReadChatId, }); @@ -73,7 +73,7 @@ export const postConfirmDatetime = async ( date: string, time: string, ) => { - await ApiClient.postWithLastDarakbangId('chat/datetime', { + await ApiClient.postWithLastDarakbangId('/chat/datetime', { moimId, date, time, @@ -81,18 +81,18 @@ export const postConfirmDatetime = async ( }; export const postConfirmPlace = async (moimId: number, place: string) => { - await ApiClient.postWithLastDarakbangId('chat/place', { + await ApiClient.postWithLastDarakbangId('/chat/place', { moimId, place, }); }; export const postPlease = async (please: PleaseInfoInput) => { - await ApiClient.postWithLastDarakbangId('please', please); + await ApiClient.postWithLastDarakbangId('/please', please); }; export const postNotificationToken = async (currentToken: string) => { - await ApiClient.postWithAuth('notification/register', { + await ApiClient.postWithAuth('/notification/register', { token: currentToken, }); }; @@ -104,7 +104,7 @@ export const postDarakbang = async ({ name: string; nickname: string; }) => { - const response = await ApiClient.postWithAuth('darakbang', { + const response = await ApiClient.postWithAuth('/darakbang', { name, nickname, }); @@ -121,7 +121,7 @@ export const postDarakbangEntrance = async ({ code: string; nickname: string; }) => { - await ApiClient.postWithAuth('darakbang/entrance?code=' + code, { + await ApiClient.postWithAuth('/darakbang/entrance?code=' + code, { nickname, }); }; From ab0036622728c1e739b38b213b757dfa7c22f87e Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 18:36:57 +0900 Subject: [PATCH 02/15] =?UTF-8?q?feat:=20=EC=A7=80=EA=B8=88=20=EB=8B=A4?= =?UTF-8?q?=EB=9D=BD=EB=B0=A9=20=EC=9D=B4=EB=A6=84=EC=9D=84=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=EC=98=A4=EB=8A=94=20=ED=9B=85=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/hooks/queries/useNowDarakbangNameById.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 frontend/src/hooks/queries/useNowDarakbangNameById.ts diff --git a/frontend/src/hooks/queries/useNowDarakbangNameById.ts b/frontend/src/hooks/queries/useNowDarakbangNameById.ts new file mode 100644 index 000000000..6009de754 --- /dev/null +++ b/frontend/src/hooks/queries/useNowDarakbangNameById.ts @@ -0,0 +1,13 @@ +import QUERY_KEYS from '@_constants/queryKeys'; +import { getDarakbangNameById } from '@_apis/gets'; +import { getLastDarakbangId } from '@_common/lastDarakbangManager'; +import { useQuery } from '@tanstack/react-query'; + +export default function useNowDarakbangName() { + const { data: darakbangName, isLoading } = useQuery({ + queryKey: [QUERY_KEYS.darakbangNameByCode, getLastDarakbangId()], + queryFn: () => getDarakbangNameById(), + }); + + return { darakbangName, isLoading }; +} From 2d1e084d2467d090765f2f7bfde73d4ad27fd800 Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 18:46:11 +0900 Subject: [PATCH 03/15] =?UTF-8?q?feat:=20=ED=95=98=EB=93=9C=EC=BD=94?= =?UTF-8?q?=EB=94=A9=20=EB=90=9C=20=ED=97=A4=EB=8D=94,=20=EB=8B=89?= =?UTF-8?q?=EB=84=A4=EC=9E=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/MineInfoCard/MineInfoCard.tsx | 4 +++- frontend/src/pages/ChatPage/ChatPage.tsx | 4 +++- .../DarakbangInvitationPage/DarakbangInvitationPage.tsx | 3 ++- .../pages/DarakbangLandingPage/DarakbangLandingPage.tsx | 8 +++++--- frontend/src/pages/MainPage/MainPage.tsx | 8 +++++--- frontend/src/pages/Mypage/MyPage.tsx | 4 +++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/MineInfoCard/MineInfoCard.tsx b/frontend/src/components/MineInfoCard/MineInfoCard.tsx index cbe95e49d..62cf77ab6 100644 --- a/frontend/src/components/MineInfoCard/MineInfoCard.tsx +++ b/frontend/src/components/MineInfoCard/MineInfoCard.tsx @@ -2,6 +2,7 @@ import * as S from '@_components/MineInfoCard/MineInfoCard.style'; import ProfileFrame from '@_components/Profile/ProfileFrame'; import { common } from '@_common/common.style'; +import useNowDarakbangName from '@_hooks/queries/useNowDarakbangNameById'; import { useTheme } from '@emotion/react'; interface MineInfoCardProps { @@ -11,6 +12,7 @@ interface MineInfoCardProps { export default function MineInfoCard(props: MineInfoCardProps) { const { nickname, profile } = props; const theme = useTheme(); + const { darakbangName } = useNowDarakbangName(); return (
안녕하세요 {nickname} - 우아한테크코스 6기 + {darakbangName}
diff --git a/frontend/src/pages/ChatPage/ChatPage.tsx b/frontend/src/pages/ChatPage/ChatPage.tsx index d9a021f1e..3e05b08db 100644 --- a/frontend/src/pages/ChatPage/ChatPage.tsx +++ b/frontend/src/pages/ChatPage/ChatPage.tsx @@ -7,17 +7,19 @@ import NavigationBarWrapper from '@_layouts/components/NavigationBarWrapper/Navi import { common } from '@_common/common.style'; import useChatPreviews from '@_hooks/queries/useChatPreiview'; import { useNavigate } from 'react-router-dom'; +import useNowDarakbangName from '@_hooks/queries/useNowDarakbangNameById'; import { useTheme } from '@emotion/react'; export default function ChatPage() { const theme = useTheme(); const { chatPreviews } = useChatPreviews(); + const { darakbangName } = useNowDarakbangName(); const navigate = useNavigate(); return ( -

우아한테크코스

+

{darakbangName}

diff --git a/frontend/src/pages/DarakbangInvitationPage/DarakbangInvitationPage.tsx b/frontend/src/pages/DarakbangInvitationPage/DarakbangInvitationPage.tsx index 0af3c1025..41182f2ff 100644 --- a/frontend/src/pages/DarakbangInvitationPage/DarakbangInvitationPage.tsx +++ b/frontend/src/pages/DarakbangInvitationPage/DarakbangInvitationPage.tsx @@ -7,13 +7,14 @@ import SolidArrow from '@_components/Icons/SolidArrow'; import StickyTriSectionHeader from '@_layouts/components/StickyTriSectionHeader/StickyTriSectionHeader'; import useDarakbangInviteCode from '@_hooks/queries/useDarakbangInviteCode'; import { useNavigate } from 'react-router-dom'; +import useNowDarakbangName from '@_hooks/queries/useNowDarakbangNameById'; import { useTheme } from '@emotion/react'; export default function DarakbangInvitationPage() { const theme = useTheme(); const navigate = useNavigate(); const { inviteCode } = useDarakbangInviteCode(); - const darakbangName = '우아한테크코스'; + const { darakbangName } = useNowDarakbangName(); return (
diff --git a/frontend/src/pages/DarakbangLandingPage/DarakbangLandingPage.tsx b/frontend/src/pages/DarakbangLandingPage/DarakbangLandingPage.tsx index f17f0d40c..886a6cad5 100644 --- a/frontend/src/pages/DarakbangLandingPage/DarakbangLandingPage.tsx +++ b/frontend/src/pages/DarakbangLandingPage/DarakbangLandingPage.tsx @@ -1,10 +1,12 @@ import Button from '@_components/Button/Button'; import CompleteLayout from '@_layouts/CompleteLayout/CompleteLayout'; import HighlightSpan from '@_components/HighlightSpan/HighlightSpan'; +import useMyInfo from '@_hooks/queries/useMyInfo'; +import useNowDarakbangName from '@_hooks/queries/useNowDarakbangNameById'; export default function DarakbangLandingPage() { - const darakbangName = '우아한테크코스'; - const nickname = 'hi'; + const { darakbangName } = useNowDarakbangName(); + const { myInfo } = useMyInfo(); return ( @@ -14,7 +16,7 @@ export default function DarakbangLandingPage() { - {nickname} + {myInfo?.nickname} {`님 반가워요~!\n이제 `} 모임을 확인해볼까요? diff --git a/frontend/src/pages/MainPage/MainPage.tsx b/frontend/src/pages/MainPage/MainPage.tsx index 7703101b2..5c4fa256b 100644 --- a/frontend/src/pages/MainPage/MainPage.tsx +++ b/frontend/src/pages/MainPage/MainPage.tsx @@ -19,11 +19,13 @@ import Notification from '@_common/assets/notification.svg'; import PlusButton from '@_components/PlusButton/PlusButton'; import ROUTES from '@_constants/routes'; import SolidArrow from '@_components/Icons/SolidArrow'; +import { requestPermission } from '@_service/notification'; import useMyDarakbangs from '@_hooks/queries/useMyDarakbang'; import useMyRoleInDarakbang from '@_hooks/queries/useMyDarakbangRole'; import { useNavigate } from 'react-router-dom'; -import { requestPermission } from '@_service/notification'; +import useNowDarakbangName from '@_hooks/queries/useNowDarakbangNameById'; import useServeToken from '@_hooks/mutaions/useServeToken'; + export default function MainPage() { const navigate = useNavigate(); const { mutate } = useServeToken(); @@ -32,7 +34,7 @@ export default function MainPage() { const { myDarakbangs, isLoading: isMyDarakbangLoading } = useMyDarakbangs(); - const nowDarakbangName = '소파밥'; + const { darakbangName = '' } = useNowDarakbangName(); const nowDarakbangId = getLastDarakbangId(); const { myRoleInDarakbang: myRoleInNowDarakbang } = useMyRoleInDarakbang(); @@ -107,7 +109,7 @@ export default function MainPage() {
- {nowDarakbangName} + {darakbangName} { diff --git a/frontend/src/pages/Mypage/MyPage.tsx b/frontend/src/pages/Mypage/MyPage.tsx index 29a902ed4..decdb27fa 100644 --- a/frontend/src/pages/Mypage/MyPage.tsx +++ b/frontend/src/pages/Mypage/MyPage.tsx @@ -4,11 +4,13 @@ import NavigationBar from '@_components/NavigationBar/NavigationBar'; import NavigationBarWrapper from '@_layouts/components/NavigationBarWrapper/NavigationBarWrapper'; import { common } from '@_common/common.style'; import useMyInfo from '@_hooks/queries/useMyInfo'; +import useNowDarakbangName from '@_hooks/queries/useNowDarakbangNameById'; import { useTheme } from '@emotion/react'; export default function MyPage() { const { myInfo, isLoading } = useMyInfo(); const theme = useTheme(); + const { darakbangName } = useNowDarakbangName(); if (isLoading) { return
Loading...
; } @@ -21,7 +23,7 @@ export default function MyPage() { - 우아한테크코스 + {darakbangName} From 8cb8a354db065a4563f851e3eaf2c164d0d9b00a Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 18:51:53 +0900 Subject: [PATCH 04/15] =?UTF-8?q?feat:=20=EB=8B=A4=EB=A5=B8=20=EB=8B=A4?= =?UTF-8?q?=EB=9D=BD=EB=B0=A9=20=EB=A7=81=ED=81=AC=EB=A1=9C=20=EB=93=A4?= =?UTF-8?q?=EC=96=B4=EA=B0=94=EC=9D=84=20=EB=95=8C=EC=97=90=20=EB=A7=81?= =?UTF-8?q?=ED=81=AC=EC=9D=98=20=EB=8B=A4=EB=9D=BD=EB=B0=A9=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=95=88=EB=93=A4=EC=96=B4=EA=B0=80=EC=A7=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/routes/ProtectedRoute.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/ProtectedRoute.tsx b/frontend/src/routes/ProtectedRoute.tsx index f13c1c461..0e577e068 100644 --- a/frontend/src/routes/ProtectedRoute.tsx +++ b/frontend/src/routes/ProtectedRoute.tsx @@ -1,7 +1,9 @@ +import { Navigate, useLocation, useParams } from 'react-router-dom'; + +import { PropsWithChildren } from 'react'; import ROUTES from '@_constants/routes'; import { checkAuthentication } from '@_utils/checkAuthentication'; -import { PropsWithChildren } from 'react'; -import { Navigate, useLocation } from 'react-router-dom'; +import { setLastDarakbangId } from '@_common/lastDarakbangManager'; export default function ProtectedRoute(props: PropsWithChildren) { const { children } = props; @@ -9,6 +11,14 @@ export default function ProtectedRoute(props: PropsWithChildren) { const isAuthenticated = checkAuthentication(); const location = useLocation(); + const params = useParams(); + + const darakbangId = +(params.darakbangId || 0); + + if (darakbangId > 0) { + setLastDarakbangId(darakbangId); + } + return isAuthenticated ? ( children ) : ( From d9b43b12d807b971103194e89a41e961d4c0a814 Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 18:55:49 +0900 Subject: [PATCH 05/15] =?UTF-8?q?fix:=ED=95=98=EB=8B=A8=20=ED=95=B4?= =?UTF-8?q?=EC=A3=BC=EC=84=B8=EC=9A=94=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=EB=B0=94=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20?= =?UTF-8?q?=ED=95=B4=EB=8B=B9=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/NavigationBar/NavigationBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/NavigationBar/NavigationBar.tsx b/frontend/src/components/NavigationBar/NavigationBar.tsx index 1489a0224..c8532c774 100644 --- a/frontend/src/components/NavigationBar/NavigationBar.tsx +++ b/frontend/src/components/NavigationBar/NavigationBar.tsx @@ -12,7 +12,7 @@ export type Tab = '홈' | '채팅' | '해주세요' | '마이페이지'; const tabRoutes: Record = { 홈: GET_ROUTES.nowDarakbang.main(), 채팅: GET_ROUTES.nowDarakbang.chat(), - 해주세요: GET_ROUTES.nowDarakbang.addPlease(), + 해주세요: GET_ROUTES.nowDarakbang.please(), 마이페이지: GET_ROUTES.nowDarakbang.myPage(), }; From a21a2e6fc2ba96d24ebfb847cbe8901724cc6a35 Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 19:04:20 +0900 Subject: [PATCH 06/15] =?UTF-8?q?fix(auth):=EC=A3=BC=EC=86=8C=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=AF=B8=20=EA=B8=B0=EC=9E=AC=EB=90=9C=20/=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/apis/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/apis/auth.ts b/frontend/src/apis/auth.ts index a034aca98..5b77c6e66 100644 --- a/frontend/src/apis/auth.ts +++ b/frontend/src/apis/auth.ts @@ -2,14 +2,14 @@ import ApiClient from './apiClient'; export const login = async (loginInputInfo: { nickname: string }) => { const response = await ApiClient.postWithoutAuth( - 'auth/login', + '/auth/login', loginInputInfo, ); return response.json(); }; export const kakaoOAuth = async (code: string) => { - const response = await ApiClient.postWithoutAuth('auth/kakao/oauth', { + const response = await ApiClient.postWithoutAuth('/auth/kakao/oauth', { code, }); console.log(response); From 71b88f4053c3950385591c62c6aef6586c603f05 Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 19:05:29 +0900 Subject: [PATCH 07/15] =?UTF-8?q?feat:=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83?= =?UTF-8?q?=EA=B3=BC=20=EB=8B=A4=EB=9D=BD=EB=B0=A9=20=EB=A9=94=EB=89=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/MainPage/MainPage.tsx | 29 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/MainPage/MainPage.tsx b/frontend/src/pages/MainPage/MainPage.tsx index 5c4fa256b..2d3f6f961 100644 --- a/frontend/src/pages/MainPage/MainPage.tsx +++ b/frontend/src/pages/MainPage/MainPage.tsx @@ -19,6 +19,7 @@ import Notification from '@_common/assets/notification.svg'; import PlusButton from '@_components/PlusButton/PlusButton'; import ROUTES from '@_constants/routes'; import SolidArrow from '@_components/Icons/SolidArrow'; +import { removeToken } from '@_utils/tokenManager'; import { requestPermission } from '@_service/notification'; import useMyDarakbangs from '@_hooks/queries/useMyDarakbang'; import useMyRoleInDarakbang from '@_hooks/queries/useMyDarakbangRole'; @@ -75,12 +76,30 @@ export default function MainPage() { ); if (myRoleInNowDarakbang === 'MANAGER') { - options.push({ - onClick: () => navigate(GET_ROUTES.nowDarakbang.darakbangManagement()), - description: '다락방 관리하기', - hasTopBorder: true, - }); + options.push( + { + onClick: () => + navigate(GET_ROUTES.nowDarakbang.darakbangManagement()), + description: '다락방 관리하기', + hasTopBorder: true, + }, + { + onClick: () => + navigate(GET_ROUTES.nowDarakbang.darakbangInvitation()), + description: '다락방 공유하기', + }, + ); } + + options.push({ + onClick: () => { + removeToken(); + navigate(ROUTES.main); + }, + description: '로그아웃', + hasTopBorder: true, + }); + return options; }, [ isMyDarakbangLoading, From 871f63c4306be0d9d2d4d34147fde858b31f05bd Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 19:14:51 +0900 Subject: [PATCH 08/15] =?UTF-8?q?feat:=20=ED=99=88=20=ED=97=A4=EB=8D=94=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=EC=8B=9C=20=EB=A9=94=EB=89=B4=20=EB=82=98?= =?UTF-8?q?=EC=98=A4=EA=B2=8C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/MainPage/MainPage.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/MainPage/MainPage.tsx b/frontend/src/pages/MainPage/MainPage.tsx index 2d3f6f961..f64c2a980 100644 --- a/frontend/src/pages/MainPage/MainPage.tsx +++ b/frontend/src/pages/MainPage/MainPage.tsx @@ -19,6 +19,7 @@ import Notification from '@_common/assets/notification.svg'; import PlusButton from '@_components/PlusButton/PlusButton'; import ROUTES from '@_constants/routes'; import SolidArrow from '@_components/Icons/SolidArrow'; +import { common } from '@_common/common.style'; import { removeToken } from '@_utils/tokenManager'; import { requestPermission } from '@_service/notification'; import useMyDarakbangs from '@_hooks/queries/useMyDarakbang'; @@ -127,14 +128,16 @@ export default function MainPage() { -
+
{ + e.stopPropagation(); + setIsDarakbangMenuOpened(!isDarakbangMenuOpened); + }} + > {darakbangName} { - e.stopPropagation(); - setIsDarakbangMenuOpened(!isDarakbangMenuOpened); - }} width="15" height="15" /> From bf89e425fbb21882a367ffac94cdd51157471285 Mon Sep 17 00:00:00 2001 From: ss0526100 Date: Wed, 21 Aug 2024 19:24:23 +0900 Subject: [PATCH 09/15] =?UTF-8?q?fix:=20=ED=99=88=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EB=84=A4=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98=EC=97=90=20?= =?UTF-8?q?=ED=99=88=20=ED=99=94=EB=A9=B4=20=ED=99=95=EC=9D=B8=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/NavigationBar/NavigationBar.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/NavigationBar/NavigationBar.tsx b/frontend/src/components/NavigationBar/NavigationBar.tsx index c8532c774..7df07966f 100644 --- a/frontend/src/components/NavigationBar/NavigationBar.tsx +++ b/frontend/src/components/NavigationBar/NavigationBar.tsx @@ -4,22 +4,22 @@ import { useLocation, useNavigate } from 'react-router-dom'; import GET_ROUTES from '@_common/getRoutes'; import NavigationBarItem from '@_components/NavigationBarItem/NavigationBarItem'; +import { common } from '@_common/common.style'; import { useState } from 'react'; import { useTheme } from '@emotion/react'; export type Tab = '홈' | '채팅' | '해주세요' | '마이페이지'; -const tabRoutes: Record = { - 홈: GET_ROUTES.nowDarakbang.main(), - 채팅: GET_ROUTES.nowDarakbang.chat(), - 해주세요: GET_ROUTES.nowDarakbang.please(), - 마이페이지: GET_ROUTES.nowDarakbang.myPage(), -}; - export default function NavigationBar() { const theme = useTheme(); const navigate = useNavigate(); const location = useLocation(); + const tabRoutes: Record = { + 홈: GET_ROUTES.nowDarakbang.main(), + 채팅: GET_ROUTES.nowDarakbang.chat(), + 해주세요: GET_ROUTES.nowDarakbang.please(), + 마이페이지: GET_ROUTES.nowDarakbang.myPage(), + }; const [currentTab, setCurrentTab] = useState( Object.keys(tabRoutes).find( @@ -34,7 +34,7 @@ export default function NavigationBar() { return (