@ithinkdt/cloud
Version:
iThinkDT Cloud
31 lines (26 loc) • 665 B
JavaScript
import { registerDict, $fetch, useDict } from '@ithinkdt/core'
import { CTX } from './ctx'
export const RoleType = {
SYSTEM: 'SYSTEM',
NORMAL: 'NORMAL',
}
export function useRoleDicts(onGet) {
const { dictType } = registerDict(
'__roles',
() =>
$fetch
.post(`${CTX.UC}cer/role/list`, {
pageSize: Math.pow(2, 31) - 1,
pageNumber: 1,
})
.then((data) => data.records),
{
autoClean: true,
label: 'roleName',
value: 'id',
},
)
return useDict(dictType, {
onGet,
})
}