chore: ticket section implement sse
This commit is contained in:
@@ -4,6 +4,7 @@ import { ROUTES } from '@/utils/routes';
|
||||
export type AppRoute = {
|
||||
path: string;
|
||||
permission?: string;
|
||||
match?: 'exact' | 'prefix';
|
||||
};
|
||||
|
||||
export const appRoutes: AppRoute[] = [
|
||||
@@ -23,8 +24,21 @@ export const appRoutes: AppRoute[] = [
|
||||
path: ROUTES.PLANS,
|
||||
permission: PERMISSIONS.PLAN.READ,
|
||||
},
|
||||
{
|
||||
path: ROUTES.UPLOAD,
|
||||
permission: PERMISSIONS.VIDEO.UPLOAD,
|
||||
},
|
||||
{
|
||||
path: ROUTES.TICKET,
|
||||
permission: PERMISSIONS.TICKET.READ,
|
||||
match: 'prefix',
|
||||
},
|
||||
];
|
||||
|
||||
export function getRoutePermission(pathname: string) {
|
||||
return appRoutes.find((route) => route.path === pathname)?.permission;
|
||||
return appRoutes.find((route) =>
|
||||
route.match === 'prefix'
|
||||
? pathname === route.path || pathname.startsWith(`${route.path}/`)
|
||||
: route.path === pathname,
|
||||
)?.permission;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user