-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from universi-me/change#648/mover-routestsx-c…
…onfigs CHANGE #648: Mover routes.tsx para src/configs
- Loading branch information
Showing
5 changed files
with
134 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import { createBrowserRouter } from 'react-router-dom'; | ||
|
||
|
||
// Import pages | ||
import { App } from "@/src/App"; | ||
import GroupPage, { GroupPageLoader } from "@/pages/Group"; | ||
import { ProfilePage, ProfilePageLoader } from "@/pages/Profile"; | ||
import Singin from "@/pages/singin/Singin"; | ||
import SignUpPage from "@/pages/SignUp"; | ||
import Recovery from "@/pages/Recovery/Recovery"; | ||
import NewPassword from "@/pages/NewPassword/NewPassword"; | ||
import ManageProfilePage, { ManageProfileLoader } from "@/pages/ManageProfile"; | ||
import Homepage from "@/pages/Homepage"; | ||
import SettingsPage, { GroupEmailFilterPage, GroupEmailFilterLoader, RolesPage, RolesPageLoader, EnvironmentsPage, EnvironmentsLoader, CompetencesSettingsPage, CompetencesSettingsLoader, GroupThemeColorPage } from "@/pages/Settings"; | ||
import ContentPage from "@/pages/Content"; | ||
import { ContentPageLoader } from "@/pages/Content/ContentPageLoader"; | ||
import PageNotFound from "@/pages/PageNotFound/PageNotFound"; | ||
import JobPage, { JobPageLoader } from "@/pages/JobPage"; | ||
import HealthCheckPage from "@/pages/HealthCheckPage"; | ||
|
||
// Import services | ||
import { OAuth2Element } from '@/services/oauth2-google'; | ||
import { KeyCloakOAuth2Element } from "@/services/oauth2-keycloak"; | ||
|
||
// Configure pages routing | ||
export const router = createBrowserRouter([{ | ||
path: "/", | ||
element: <App />, | ||
errorElement: <PageNotFound />, | ||
children: [ | ||
{ | ||
path: "/", | ||
element: <Homepage /> | ||
}, | ||
{ | ||
path: "/profile/:id", | ||
element: <ProfilePage />, | ||
loader: ProfilePageLoader | ||
}, | ||
{ | ||
path: "/manage-profile", | ||
element: <ManageProfilePage />, | ||
loader: ManageProfileLoader | ||
}, | ||
{ | ||
path: "/group/*", | ||
element: <GroupPage />, | ||
loader: GroupPageLoader | ||
}, | ||
{ | ||
path: "/recovery-password/:id", | ||
element: <NewPassword /> | ||
}, | ||
{ | ||
path: "/login", | ||
element: <Singin /> | ||
}, | ||
{ | ||
path: "/signup", | ||
element: <SignUpPage /> | ||
}, | ||
{ | ||
path: "/recovery", | ||
element: <Recovery /> | ||
}, | ||
{ | ||
path: "/google-oauth-redirect", | ||
element: <OAuth2Element /> | ||
}, | ||
{ | ||
path: "/keycloak-oauth-redirect", | ||
element: <KeyCloakOAuth2Element /> | ||
}, | ||
{ | ||
path: "/settings", | ||
element: <SettingsPage />, | ||
children: [ | ||
{ | ||
path: "email-filter", | ||
element: <GroupEmailFilterPage />, | ||
loader: GroupEmailFilterLoader, | ||
}, | ||
{ | ||
path: "roles", | ||
element: <RolesPage />, | ||
loader: RolesPageLoader, | ||
}, | ||
{ | ||
path: "environments", | ||
element: <EnvironmentsPage />, | ||
loader: EnvironmentsLoader, | ||
}, | ||
{ | ||
path: "competences", | ||
element: <CompetencesSettingsPage />, | ||
loader: CompetencesSettingsLoader, | ||
}, | ||
{ | ||
path: "theme-color", | ||
element: <GroupThemeColorPage />, | ||
} | ||
], | ||
}, | ||
{ | ||
path: "/content/:id", | ||
element: <ContentPage />, | ||
loader: ContentPageLoader, | ||
}, | ||
{ | ||
path: "/job/:id", | ||
element: <JobPage />, | ||
loader: JobPageLoader | ||
} | ||
] | ||
}, { | ||
path: "/health", | ||
element: <HealthCheckPage /> | ||
} ]); | ||
|
||
|
||
export function goTo( pathname: string ) { | ||
if ( !window ) | ||
return; | ||
|
||
const pathnameWithSlash = pathname.startsWith('/') ? pathname : "/" + pathname; | ||
const destiny = `${window.location.origin}${pathnameWithSlash}`; | ||
const alreadyThere = location.href === destiny; | ||
|
||
if ( !alreadyThere ) | ||
router.navigate( pathnameWithSlash ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.