Browse Source

fix: gantt token

pull/1/head
wahyun 5 months ago
parent
commit
615b0a45df
  1. 2
      src/views/SimproV2/Gantt/GanttFrame.js
  2. 19
      src/views/SimproV2/Gantt/index.js

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

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { useHistory, withRouter } from 'react-router-dom'; import { useHistory, withRouter } from 'react-router-dom';
import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst'; import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
const GanttFrame = React.memo((props) => { const GanttFrame = React.memo(({ versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, companyId, role_name, company_name }) => {
const history = useHistory(); const history = useHistory();
const { versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, companyId, role_name, company_name } = props; const { versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, companyId, role_name, company_name } = props;
const iframeSrc = `https://si-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${companyId}&company_name=${company_name}`; const iframeSrc = `https://si-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${companyId}&company_name=${company_name}`;

19
src/views/SimproV2/Gantt/index.js

@ -10,7 +10,21 @@ let roCount = 0;
const Gantt = (props) => { const Gantt = (props) => {
const location = useLocation(); const location = useLocation();
const { isLogin, token, role_id, user_id, company_id, dataViewStartDate, companyName, role_name } = location.state || {}; const { company_id, dataViewStartDate, companyName, role_name } = location.state || {};
let role_id = '', userId = '', isLogin = '', token = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
userId = props.location.state.user_id;
token = props.location.state.token;
isLogin = props.location.state.isLogin;
} else {
role_id = localStorage.getItem("role_id");
userId = localStorage.getItem("user_id");
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -76,7 +90,7 @@ const Gantt = (props) => {
}; };
const cekPermission = () => { const cekPermission = () => {
let check = listUserGant.includes(parseInt(user_id)); let check = listUserGant.includes(parseInt(userId));
if (check) { if (check) {
setRo(0); setRo(0);
} else { } else {
@ -100,6 +114,7 @@ const Gantt = (props) => {
role_name={role_name} role_name={role_name}
companyId={company_id} companyId={company_id}
timestamp={timestamp} timestamp={timestamp}
dataViewStartDate={dataViewStartDate}
company_name={companyName} company_name={companyName}
/> />
)} )}

Loading…
Cancel
Save