Browse Source

add props

pull/1/head
wahyuun 1 year ago
parent
commit
426567e434
  1. 25
      src/views/SimproV2/CreatedProyek/index.js

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

@ -93,25 +93,25 @@ import { Icon } from "@iconify/react";
import { Link, useHistory, withRouter } from "react-router-dom";
const url = "";
// const proyek_id = localStorage.getItem("proyek_id");
// const role_id = localStorage.getItem("role_id");
// const user_id = localStorage.getItem("user_id");
const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => {
let role_id = '', user_id='',proyek_id='';
let role_id = '', user_id='',proyek_id='',isLogin='',token='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
user_id = props.location.state.user_id;
console.log('role_id:', role_id);
token = props.location.state.token;
isLogin = props.location.state.isLogin;
console.log('props.location.state success');
} else {
role_id = localStorage.getItem("role_id");
proyek_id = localStorage.getItem("proyek_id");
user_id = localStorage.getItem("user_id");
console.error('Role ID is undefined in props.location.state');
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
console.error('Undefined in props.location.state');
}
const history = useHistory();
const token = localStorage.getItem("token");
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -294,9 +294,10 @@ const CreatedProyek = ({ params, ...props }) => {
);
return;
} else if (result.status == 200 && result.data.data) {
history.push(
`/dashboard-customer/${id}/${result.data.gantt}/1`
);
history.push({
pathname: `/dashboard-customer/${id}/${result.data.gantt}/1`,
state: { role_id: role_id, user_id: user_id, token: token, isLogin: true }
});
}
};
@ -1942,6 +1943,10 @@ const CreatedProyek = ({ params, ...props }) => {
closeDialog={closeDialogGantt}
toggleDialog={toggleDialogGantt}
idTask={idTask}
role_id={role_id}
user_id={user_id}
token={token}
isLogin={isLogin}
proyekName={proyekName}
/>
),

Loading…
Cancel
Save