27 lines
895 B
TypeScript
27 lines
895 B
TypeScript
import { Outlet, useNavigate } from 'react-router-dom';
|
|
import React, { useState, useEffect, useRef } from 'react';
|
|
import { useSearchParams } from 'react-router-dom';
|
|
|
|
import { requestCrudService } from '@/service/request-axios-service';
|
|
const service = requestCrudService;
|
|
const userInfo = localStorage.getItem('userInfo');
|
|
const pgLinkUrl = import.meta.env.VITE_AIPI_PGLINKTO_URL;
|
|
interface TaskPgFromProps {
|
|
gopath: string
|
|
}
|
|
const TaskPgFrom: React.FC<TaskPgFromProps> = ({gopath}) => {
|
|
const [pgUrl, setPgUrl] = useState(pgLinkUrl);
|
|
useEffect(() => {
|
|
if(userInfo) {
|
|
const userData = JSON.parse(userInfo);
|
|
setPgUrl(`${pgUrl}?access_token=${userData.accessToken}&goPath=${gopath}`);
|
|
}
|
|
}, [gopath]);
|
|
return (
|
|
<div className="h-full flex flex-col">
|
|
<iframe className="h-[calc(100vh-92px)]" src={pgUrl}></iframe>
|
|
</div>
|
|
);
|
|
}
|
|
export default TaskPgFrom
|