Skip to content

Commit

Permalink
🚧 Adding all routes here...
Browse files Browse the repository at this point in the history
  • Loading branch information
oitashg committed Sep 21, 2024
1 parent 20d8435 commit 35ada7a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ import Cart from './components/core/Dashboard/Cart';
import { useSelector } from 'react-redux';
import { ACCOUNT_TYPE } from './utils/constants';
import AddCourse from './components/core/Dashboard/AddCourse';
import MyCourses from './components/core/Dashboard/MyCourses';
import EditCourse from './components/core/Dashboard/EditCourse';
import Catalog from './pages/Catalog';
import CourseDetails from './pages/CourseDetails';
import VideoDetails from './components/core/ViewCourse/VideoDetails';
import ViewCourse from './pages/ViewCourse';
import Instructor from './components/core/Dashboard/InstructorDashboard/Instructor';

function App() {

Expand All @@ -36,6 +43,10 @@ function App() {
<Routes>
<Route path='/' element={<Home/>}/>

{/* Route for respective catagories */}
<Route path='catalog/:catalogName' element={<Catalog/>}/>
<Route path='courses/:courseId' element={<CourseDetails/>}/>

{/* Wrapped in openRoute so that everyone can visit */}
<Route
path='/login'
Expand Down Expand Up @@ -120,13 +131,32 @@ function App() {
//Always add ? to ensure whether accountType is present or not
user?.accountType === ACCOUNT_TYPE.INSTRUCTOR && (
<>
<Route path='dashboard/instructor' element={<Instructor/>}/>
<Route path='dashboard/add-course' element={<AddCourse/>}/>
<Route path='dashboard/my-courses' element={<MyCourses/>}/>
<Route path='dashboard/edit-course/:courseId' element={<EditCourse/>}/>
</>
)
}

</Route>

<Route element={
<PrivateRoute>
<ViewCourse/>
</PrivateRoute>
}>
{
user?.accountType === ACCOUNT_TYPE.STUDENT && (
<>
<Route
path='view-course/:courseId/section/:sectionId/sub-section/:subSectionId'
element={<VideoDetails/>}/>
</>
)
}
</Route>

{/* If unknown route then show error page */}
<Route path='*' element={<Error/>}/>
</Routes>
Expand Down

0 comments on commit 35ada7a

Please sign in to comment.