Browse Source

add props

pull/1/head
wahyuun 1 year ago
parent
commit
018fc431b6
  1. 23
      src/views/SimproV2/Gantt/GanttFrame.js

23
src/views/SimproV2/Gantt/GanttFrame.js

@ -1,11 +1,26 @@
import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { useHistory, withRouter } from 'react-router-dom';
import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
const GanttFrame = React.memo((props) => {
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;
isLogin = props.location.state.isLogin;
token = props.location.state.token;
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");
isLogin = localStorage.getItem("isLogin");
token = localStorage.getItem("token");
console.error('Undefined in props.location.state');
}
const history = useHistory();
const { versionGanttId, idProject, token, ro, timestamp } = props;
const iframeSrc = `https://adw-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}`;
const { versionGanttId, idProject, ro, timestamp } = props;
const iframeSrc = `http://localhost:8444/adw-gantt/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&role_id=${role_id}&user_id=${user_id}&isLogin=${isLogin}`;
@ -46,4 +61,4 @@ const GanttFrame = React.memo((props) => {
);
});
export default GanttFrame;
export default withRouter(GanttFrame);

Loading…
Cancel
Save