refactor: 拆分品牌业务类型与页面方案
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
This commit is contained in:
1 parent
f02e2cafbb
commit
0d9f4a7d6f
86 files changed
+4111
-1543
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { createElement, type ReactNode } from "react";
|
||||
import { Navigate } from "react-router-dom";
|
||||
|
||||
export const createBrandFallbackPath = "/admin/brands";
|
||||
|
||||
export function canCreateBrand(role: string) {
|
||||
return role === "owner";
|
||||
}
|
||||
|
||||
export function createBrandRouteElement(role: string, content: ReactNode) {
|
||||
return canCreateBrand(role)
|
||||
? content
|
||||
: createElement(Navigate, { to: createBrandFallbackPath, replace: true });
|
||||
}
|
||||
Reference in new issue
Block a user