Skip to content

Commit 9b01efa

Browse files
fix: path arg optional
1 parent 05a5d50 commit 9b01efa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

example/routes.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,24 @@ export const routes: IRoutesConfig = {
128128
},
129129
{
130130
path: '/common',
131-
component: <h1>Common page</h1>,
131+
component: (
132+
<>
133+
common page layout <Outlet />
134+
</>
135+
),
132136
children: [
137+
{
138+
index: true,
139+
component: <h1>Common page</h1>,
140+
},
133141
{
134142
path: 'nested',
135-
component: <h1>a nested common path</h1>,
143+
component: <Outlet />,
136144
children: [
145+
{
146+
index: true,
147+
component: <h1>a nested common path</h1>,
148+
},
137149
{
138150
path: 'more',
139151
component: <h1>need more ?</h1>,

src/hooks/use-role.hook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { RouterContext } from '../context/context';
1111
* @returns [boolean]
1212
*/
1313
export const useRole = (
14-
path: string,
14+
path?: string,
1515
routeRoles?: string[],
1616
allRolesRequired?: boolean,
1717
) => {
@@ -34,7 +34,7 @@ export const useRole = (
3434
};
3535

3636
const checkRole = (
37-
path: string,
37+
path?: string,
3838
routeRoles?: string[],
3939
userRole?: string[] | string,
4040
allRolesRequired?: boolean,

0 commit comments

Comments
 (0)