Browse Source

customfunc

pull/1/head
khaidralirahman 8 months ago
parent
commit
5d2e9f052f
  1. 40
      src/const/CustomFunc.js

40
src/const/CustomFunc.js

@ -164,6 +164,46 @@ export const QUERY_BUILDER_FIELD_SALES =
}, },
} }
export const checkActMenup = (menuPath, actProp) => {
let foundObj;
let entireObj = JSON.parse(localStorage.getItem("menu_login"));
JSON.stringify(entireObj, (_, nestedValue) => {
if (nestedValue && nestedValue.url === menuPath) {
foundObj = nestedValue;
}
return nestedValue;
});
let output = false;
let actValue = actProp.trim().toLowerCase()
switch (actValue) {
case "create":
if (foundObj[actValue] === true) {
output = true;
} else {
output = false;
}
case "read":
if (foundObj[actValue] === true) {
output = true;
}
case "update":
if (foundObj[actValue] === true) {
output = true;
}
case "delete":
if (foundObj[actValue] === true) {
output = true;
}
// default:
// output = false
}
return output;
// return foundObj[actProp];
};
export const QUERY_BUILDER_FIELD_CUSTOMER = export const QUERY_BUILDER_FIELD_CUSTOMER =
{ {
"properties->name": { "properties->name": {

Loading…
Cancel
Save