修复定时任务详情页查看历史日志异常

This commit is contained in:
whyour 2023-10-09 23:56:35 +08:00
parent c35cfba8b0
commit 5e73f0390f
2 changed files with 7 additions and 5 deletions

View File

@ -120,10 +120,11 @@ const CronDetailModal = ({
}; };
const onClickItem = (item: LogItem) => { const onClickItem = (item: LogItem) => {
localStorage.setItem('logCron', currentCron.id); const url = `${config.apiPrefix}logs/${item.filename}?path=${
setLogUrl( item.directory || ''
`${config.apiPrefix}logs/${item.filename}?path=${item.directory || ''}`, }`;
); localStorage.setItem('logCron', url);
setLogUrl(url);
request request
.get( .get(
`${config.apiPrefix}logs/${item.filename}?path=${item.directory || ''}`, `${config.apiPrefix}logs/${item.filename}?path=${item.directory || ''}`,

View File

@ -40,6 +40,7 @@ const CronLogModal = ({
const [executing, setExecuting] = useState<any>(true); const [executing, setExecuting] = useState<any>(true);
const [isPhone, setIsPhone] = useState(false); const [isPhone, setIsPhone] = useState(false);
const scrollInfoRef = useRef({ value: 0, down: true }); const scrollInfoRef = useRef({ value: 0, down: true });
const uniqPath = logUrl ? logUrl : String(cron?.id);
const getCronLog = (isFirst?: boolean) => { const getCronLog = (isFirst?: boolean) => {
if (isFirst) { if (isFirst) {
@ -50,7 +51,7 @@ const CronLogModal = ({
.then(({ code, data }) => { .then(({ code, data }) => {
if ( if (
code === 200 && code === 200 &&
localStorage.getItem('logCron') === String(cron.id) && localStorage.getItem('logCron') === uniqPath &&
data !== value data !== value
) { ) {
const log = data as string; const log = data as string;