mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 14:54:22 +00:00
✨ Create GroupRouter
This commit is contained in:
parent
a526dfc1d4
commit
a765681c3f
3 changed files with 27 additions and 2 deletions
|
@ -6,6 +6,7 @@ import {AuthorizationRouter} from "./components/authorization/AuthorizationRoute
|
|||
import {AuthorizationStepPage} from "./components/authorization/AuthorizationStepPage"
|
||||
import {SophonFooter} from "./components/elements/SophonFooter"
|
||||
import {ErrorCatcherBox} from "./components/errors/ErrorCatcherBox"
|
||||
import {GroupRouter} from "./components/group/GroupRouter"
|
||||
import {InstanceRouter} from "./components/instance/InstanceRouter"
|
||||
import {InstanceStepPage} from "./components/instance/InstanceStepPage"
|
||||
import {DebugBox} from "./components/placeholder/DebugBox"
|
||||
|
@ -29,8 +30,13 @@ function App({...props}: RouteComponentProps) {
|
|||
unselectedRoute={() => <>
|
||||
<AuthorizationStepPage/>
|
||||
</>}
|
||||
selectedRoute={() => <>
|
||||
<GroupRouter
|
||||
unselectedRoute={DebugBox}
|
||||
selectedRoute={DebugBox}
|
||||
/>
|
||||
</>}
|
||||
/>
|
||||
</AuthorizationProvider>
|
||||
</>}
|
||||
/>
|
||||
|
|
15
frontend/src/components/group/GroupRouter.tsx
Normal file
15
frontend/src/components/group/GroupRouter.tsx
Normal file
|
@ -0,0 +1,15 @@
|
|||
import * as React from "react"
|
||||
import {useManagedViewSet} from "../../hooks/useManagedViewSet"
|
||||
import {SophonResearchGroup} from "../../types/SophonTypes"
|
||||
import {ViewSetRouter} from "../routing"
|
||||
import {SpecificViewSetRouterProps} from "../routing/ViewSetRouter"
|
||||
|
||||
|
||||
export function GroupRouter({...props}: SpecificViewSetRouterProps<SophonResearchGroup>): JSX.Element {
|
||||
return (
|
||||
<ViewSetRouter
|
||||
{...props}
|
||||
viewSet={useManagedViewSet<SophonResearchGroup>("/api/core/groups/", "slug")}
|
||||
/>
|
||||
)
|
||||
}
|
|
@ -17,7 +17,11 @@ export interface DetailsRouteProps<Resource> {
|
|||
}
|
||||
|
||||
|
||||
export interface ViewSetRouterProps<Resource> extends ResourceRouterProps<ManagedResource<Resource>, ListRouteProps<Resource>, DetailsRouteProps<Resource>> {
|
||||
export interface SpecificViewSetRouterProps<Resource> extends ResourceRouterProps<ManagedResource<Resource>, ListRouteProps<Resource>, DetailsRouteProps<Resource>> {
|
||||
}
|
||||
|
||||
|
||||
export interface ViewSetRouterProps<Resource> extends SpecificViewSetRouterProps<Resource> {
|
||||
viewSet: ManagedViewSet<Resource>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue