Skip to content

Commit

Permalink
Merge pull request #42 from sayyyho/dev
Browse files Browse the repository at this point in the history
Test: 소켓통신 테스트
  • Loading branch information
sayyyho authored Sep 6, 2024
2 parents edfd233 + d5c71f6 commit 687185d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/pages/ChatPage/ChatPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export const ChatPage = () => {
const username = localStorage.getItem("username");
localStorage.setItem("chatroomUUID", params.room);
if (!username) {
// 로컬 스토리지에 username이 없으면 로딩 페이지로 이동
navigate("/");
localStorage.setItem("nextpage", "/chatting/info/another");
navigate("/");
} else {
// username이 이미 있는 경우 소켓 연결 설정
socketRef.current = io(`${import.meta.env.VITE_BASE_API}/${params.room}`);
Expand Down
1 change: 1 addition & 0 deletions src/pages/ChatSetting/ChatInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const ChatInfo = () => {
<p
style={{
fontSize: "0.8rem",
textAlign: "center",
}}
>
{file.name}
Expand Down
5 changes: 5 additions & 0 deletions src/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { OnboardingPage4 } from "./pages/OnboardingPage/OnboardingPage.4.jsx";
import { ChatInfo } from "./pages/ChatSetting/ChatInfo";
import { ChatRelation } from "./pages/ChatSetting/ChatRelation";
import { Share } from "./pages/SharePage/Share";
import { ChatAnother } from "./pages/ChatSetting/ChatAnother";

// ProtectedRoute 컴포넌트 정의
const ProtectedRoute = ({ element }) => {
Expand Down Expand Up @@ -63,6 +64,10 @@ const router = createBrowserRouter([
path: "chatting/info/relation",
element: <ProtectedRoute element={<ChatRelation />} />,
},
{
path: "chatting/info/another",
element: <ProtectedRoute element={<ChatAnother />} />,
},
{
path: "mypage",
element: <ProtectedRoute element={<MyPage />} />,
Expand Down

0 comments on commit 687185d

Please sign in to comment.