Improve client routing
Change-Id: I15f93ddbb21cee0ba868e163723b136d9e8c665f
diff --git a/client/src/pages/AddContactPage.tsx b/client/src/pages/AddContactPage.tsx
index dd93376..2c2bfb2 100644
--- a/client/src/pages/AddContactPage.tsx
+++ b/client/src/pages/AddContactPage.tsx
@@ -50,7 +50,7 @@
console.log(response);
if (response.conversationId) {
- navigate(`/account/conversation/${response.conversationId}`);
+ navigate(`/conversation/${response.conversationId}`);
}
};
diff --git a/client/src/pages/CallInterface.tsx b/client/src/pages/CallInterface.tsx
index b22821c..5759721 100644
--- a/client/src/pages/CallInterface.tsx
+++ b/client/src/pages/CallInterface.tsx
@@ -44,8 +44,8 @@
CallingVolumeButton,
} from '../components/CallButtons';
import WebRTCProvider, { WebRTCContext } from '../contexts/WebRTCProvider';
+import { CallRouteParams } from '../router';
import { useUrlParams } from '../utils/hooks';
-import { CallRouteParams } from './JamiMessenger';
export default () => {
const {
diff --git a/client/src/pages/JamiMessenger.tsx b/client/src/pages/JamiMessenger.tsx
deleted file mode 100644
index b0b0812..0000000
--- a/client/src/pages/JamiMessenger.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2022 Savoir-faire Linux Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation; either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this program. If not, see
- * <https://www.gnu.org/licenses/>.
- */
-import { Route, Routes } from 'react-router-dom';
-
-import { RouteParams } from '../utils/hooks';
-import CallInterface from './CallInterface';
-import Messenger from './Messenger';
-
-export type MessengerRouteParams = RouteParams<{ conversationId?: string; contactId?: string }, Record<string, never>>;
-export type CallRouteParams = RouteParams<{ conversationId: string }, { video?: 'true' }>;
-
-export default function JamiMessenger() {
- return (
- <Routes>
- <Route path="addContact/:contactId" element={<Messenger />} />
- <Route path="conversation/:conversationId" element={<Messenger />} />
- <Route path="call/:conversationId" element={<CallInterface />} />
- <Route path="*" element={<Messenger />} />
- </Routes>
- );
-}
diff --git a/client/src/pages/Messenger.tsx b/client/src/pages/Messenger.tsx
index fdbb0f4..83d1352 100644
--- a/client/src/pages/Messenger.tsx
+++ b/client/src/pages/Messenger.tsx
@@ -27,10 +27,10 @@
import NewContactForm from '../components/NewContactForm';
import { useAuthContext } from '../contexts/AuthProvider';
import { useAppSelector } from '../redux/hooks';
+import { MessengerRouteParams } from '../router';
import { apiUrl } from '../utils/constants';
import { useUrlParams } from '../utils/hooks';
import AddContactPage from './AddContactPage';
-import { MessengerRouteParams } from './JamiMessenger';
const Messenger = () => {
const { refresh } = useAppSelector((state) => state.userInfo);