@e7w/easy-routes 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ const PermissionSchema = z.object({
|
|
|
15
15
|
init: z.function({ output: z.union([z.promise(z.void()), z.void()]) }),
|
|
16
16
|
permission: z.number(),
|
|
17
17
|
defaultTitle: z.string()
|
|
18
|
-
});
|
|
18
|
+
}).describe("权限");
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/components/DefaultOutlet.tsx
|
|
21
21
|
const DefaultOutlet = () => {
|
|
@@ -411,7 +411,11 @@ filePaths.forEach((filePath) => {
|
|
|
411
411
|
};
|
|
412
412
|
await system.init(req)?.catch?.(() => {});
|
|
413
413
|
const ctx = system.getCtx(req, meta.permission);
|
|
414
|
-
|
|
414
|
+
try {
|
|
415
|
+
await meta.loader?.(ctx);
|
|
416
|
+
} catch (error) {
|
|
417
|
+
console.error(error);
|
|
418
|
+
}
|
|
415
419
|
if (!ctx.signed) return redirect(`/login?from=${encodeURIComponent(request.url)}`);
|
|
416
420
|
if (ctx.noPermission) return redirect("/403");
|
|
417
421
|
document.title = ctx.title;
|