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

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) => {
localStorage.setItem('logCron', currentCron.id);
setLogUrl(
`${config.apiPrefix}logs/${item.filename}?path=${item.directory || ''}`,
);
const url = `${config.apiPrefix}logs/${item.filename}?path=${
item.directory || ''
}`;
localStorage.setItem('logCron', url);
setLogUrl(url);
request
.get(
`${config.apiPrefix}logs/${item.filename}?path=${item.directory || ''}`,

View File

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