Browse Source

remove company id from menu

pull/2/head
farhan048 1 year ago
parent
commit
ed163d2acc
  1. 3
      src/views/Master/MasterMenu/DialogForm.js
  2. 12
      src/views/Master/MasterMenu/index.js

3
src/views/Master/MasterMenu/DialogForm.js

@ -7,7 +7,6 @@ import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const company_id = window.localStorage.getItem('company_id');
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataMenu }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataMenu }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [name, setName] = useState('') const [name, setName] = useState('')
@ -69,7 +68,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
sequence: parseInt(sequence), sequence: parseInt(sequence),
icon, icon,
alias_name: aliasName, alias_name: aliasName,
company_id
} }
if (parentId && parentId > 0) { if (parentId && parentId > 0) {
@ -85,7 +83,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
sequence: parseInt(sequence), sequence: parseInt(sequence),
icon, icon,
alias_name: aliasName, alias_name: aliasName,
company_id
} }
if (parentId && parentId > 0) { if (parentId && parentId > 0) {

12
src/views/Master/MasterMenu/index.js

@ -10,8 +10,6 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { Pagination, Tooltip, Table } from 'antd'; import { Pagination, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = window.localStorage.getItem('company_id');
const role_name = window.localStorage.getItem('role_name');
const column = [ const column = [
{ name: "Nama" }, { name: "Nama" },
{ name: "Url" }, { name: "Url" },
@ -106,16 +104,6 @@ const Index = ({ params }) => {
}], }],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
}
const result = await axios const result = await axios
.post(MENU_SEARCH, payload, config) .post(MENU_SEARCH, payload, config)

Loading…
Cancel
Save