Browse Source

update condition

pull/1/head
farhan048 1 year ago
parent
commit
c6880d8236
  1. 14
      src/views/SimproV2/CreatedProyek/index.js

14
src/views/SimproV2/CreatedProyek/index.js

@ -96,20 +96,19 @@ const url = "";
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => { const CreatedProyek = ({ params, ...props }) => {
let role_id = '', user_id='',proyek_id='',isLogin='',token=''; let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id; role_id = props.location.state.role_id;
user_id = props.location.state.user_id; user_id = props.location.state.user_id;
token = props.location.state.token; token = props.location.state.token;
isLogin = props.location.state.isLogin; isLogin = props.location.state.isLogin;
console.log('props.location.state success');
} else { } else {
role_id = localStorage.getItem("role_id"); role_id = localStorage.getItem("role_id");
proyek_id = localStorage.getItem("proyek_id"); proyek_id = localStorage.getItem("proyek_id");
user_id = localStorage.getItem("user_id"); user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token"); token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin"); isLogin = localStorage.getItem("isLogin");
console.error('Undefined in props.location.state');
} }
const history = useHistory(); const history = useHistory();
const HEADER = { const HEADER = {
@ -210,7 +209,10 @@ const CreatedProyek = ({ params, ...props }) => {
}, [openDialogProyek]); }, [openDialogProyek]);
useEffect(() => { useEffect(() => {
parseInt(role_id) !== 44 ? getDataProyek() : getDataProyekByCustomer(); if (parseInt(role_id) === 44) {
getDataProyekByCustomer()
}
getDataProyek();
}, [search, rowsPerPage, currentPage]); }, [search, rowsPerPage, currentPage]);
useEffect(() => { useEffect(() => {
@ -714,7 +716,7 @@ const CreatedProyek = ({ params, ...props }) => {
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
setLoading(false) setLoading(false)
setProjectImage(result.data.data); setProjectImage(result.data.data);
}else{ } else {
setLoading(false) setLoading(false)
} }
} }
@ -1631,7 +1633,7 @@ const CreatedProyek = ({ params, ...props }) => {
dataIndex: "", dataIndex: "",
key: "x", key: "x",
render: (text, record) => render: (text, record) =>
parseInt(role_id) == 44 ? ( parseInt(role_id) == 44 ? (
<> <>
<Tooltip title="Dashboard Project"> <Tooltip title="Dashboard Project">
<Button <Button

Loading…
Cancel
Save