|
@@ -22,7 +22,7 @@ export const isAntDesignProOrDev = (): boolean => {
|
|
|
|
|
|
export const formatPermission = (type: 'init' | 'submit', values: any) => {
|
|
export const formatPermission = (type: 'init' | 'submit', values: any) => {
|
|
if (type === 'init') {
|
|
if (type === 'init') {
|
|
- const newValues = { ...JSON.parse(values) }
|
|
|
|
|
|
+ const newValues = (values && { ...JSON.parse(values) }) || {}
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
for (const key in newValues) {
|
|
for (const key in newValues) {
|
|
if (Object.prototype.hasOwnProperty.call(newValues, key)) {
|
|
if (Object.prototype.hasOwnProperty.call(newValues, key)) {
|
|
@@ -33,7 +33,7 @@ export const formatPermission = (type: 'init' | 'submit', values: any) => {
|
|
}
|
|
}
|
|
return newValues
|
|
return newValues
|
|
}
|
|
}
|
|
- const newValues = { ...values }
|
|
|
|
|
|
+ const newValues = { ...(values || {}) }
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
for (const key in newValues) {
|
|
for (const key in newValues) {
|
|
if (Object.prototype.hasOwnProperty.call(values, key)) {
|
|
if (Object.prototype.hasOwnProperty.call(values, key)) {
|