MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / pushWithAccessCheck

Function pushWithAccessCheck

frontend/src/utils/router.ts:8–16  ·  view source on GitHub ↗
(to: RouteLocationRaw)

Source from the content-addressed store, hash-verified

6import type { RouteLocationRaw } from 'vue-router';
7
8const pushWithAccessCheck = async (to: RouteLocationRaw) => {
9 const resolvedRoute = router.resolve(to);
10 if (!hasRouteAccess(resolvedRoute)) {
11 MsgError(i18n.global.t('commons.res.forbidden'));
12 return;
13 }
14 await router.push(to);
15 tabStoreMiddleWare();
16};
17
18export const routerToName = async (name: string) => {
19 await pushWithAccessCheck({ name: name });

Callers 6

routerToNameFunction · 0.85
routerToPathFunction · 0.85
routerToFileWithPathFunction · 0.85
routerToNameWithQueryFunction · 0.85
routerToPathWithQueryFunction · 0.85
routerToNameWithParamsFunction · 0.85

Calls 3

hasRouteAccessFunction · 0.90
MsgErrorFunction · 0.90
tabStoreMiddleWareFunction · 0.85

Tested by

no test coverage detected