Commit 8cb4c8d1a8d94d18d95790fc87f5eb885d7f8f04
1 parent
1598a7ea
fix: 优化角色权限判断逻辑- 修复了Sales相关角色权限的判断逻辑
- 统一使用?.操作符进行null安全调用 - 优化了代码格式,保持一致性
Showing
1 changed file
with
3 additions
and
3 deletions
src/access.ts
... | ... | @@ -7,10 +7,10 @@ export default (initialState: API.UserInfo) => { |
7 | 7 | const canReadProcure = |
8 | 8 | roles?.includes('PROCURE') || roles?.includes('PROCURE_MANAGER'); |
9 | 9 | const canReadFinance = roles?.includes('FINANCE'); |
10 | - const canReadWarehouseKeeper = roles.includes('WAREHOUSE_KEEPER'); | |
10 | + const canReadWarehouseKeeper = roles?.includes('WAREHOUSE_KEEPER'); | |
11 | 11 | const canReadSales = |
12 | - roles.includes('SALES_MANAGER') || roles.includes('SALES_REPRESENTATIVE'); | |
13 | - const canReadSalesManager = roles.includes('SALES_MANAGER'); | |
12 | + roles?.includes('SALES_MANAGER') || roles?.includes('SALES_REPRESENTATIVE'); | |
13 | + const canReadSalesManager = roles?.includes('SALES_MANAGER'); | |
14 | 14 | return { |
15 | 15 | canReadAdmin: canReadAdmin, |
16 | 16 | canReadProcure: canReadProcure || canReadAdmin, | ... | ... |