react-toolkits 2.13.35 → 2.13.36
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/CHANGELOG.md +6 -0
- package/lib/index.js +8 -16
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -633,22 +633,14 @@ function usePermission(code, config) {
|
|
|
633
633
|
permissionCodes.length > 0 ? [url4, body, config] : null,
|
|
634
634
|
(args) => axios2.post(...args).then((response) => response.data.data)
|
|
635
635
|
);
|
|
636
|
-
let newData;
|
|
637
|
-
if (
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
newData = { [code[0]]: true };
|
|
645
|
-
} else {
|
|
646
|
-
newData = permissionCodes.reduce((acc, curr) => {
|
|
647
|
-
acc[curr] = data.has_all ? true : data[curr] ?? false;
|
|
648
|
-
return acc;
|
|
649
|
-
}, {});
|
|
650
|
-
}
|
|
651
|
-
}
|
|
636
|
+
let newData = true;
|
|
637
|
+
if (typeof code === "string") {
|
|
638
|
+
newData = data?.has_all ? true : data?.[code] ?? false;
|
|
639
|
+
} else if (Array.isArray(code) && code.length > 0) {
|
|
640
|
+
newData = permissionCodes.reduce((acc, curr) => {
|
|
641
|
+
acc[curr] = data?.has_all ? true : data?.[curr] ?? false;
|
|
642
|
+
return acc;
|
|
643
|
+
}, {});
|
|
652
644
|
}
|
|
653
645
|
return {
|
|
654
646
|
...rest,
|