修复定时任务详情日志查看

This commit is contained in:
whyour
2022-03-12 23:49:09 +08:00
parent 54dd90e7c5
commit d0e46224dc
5 changed files with 67 additions and 28 deletions
+5 -3
View File
@@ -21,11 +21,13 @@ const CronLogModal = ({
handleCancel,
visible,
data,
logUrl,
}: {
cron?: any;
visible: boolean;
handleCancel: () => void;
data?: string;
logUrl?: string;
}) => {
const [value, setValue] = useState<string>('启动中...');
const [loading, setLoading] = useState<any>(true);
@@ -38,7 +40,7 @@ const CronLogModal = ({
setLoading(true);
}
request
.get(`${config.apiPrefix}crons/${cron.id}/log`)
.get(logUrl ? logUrl : `${config.apiPrefix}crons/${cron.id}/log`)
.then((data: any) => {
if (localStorage.getItem('logCron') === String(cron.id)) {
const log = data.data as string;
@@ -99,10 +101,10 @@ const CronLogModal = ({
};
useEffect(() => {
if (cron && cron.id) {
if (cron && cron.id && visible) {
getCronLog(true);
}
}, [cron]);
}, [cron, visible]);
useEffect(() => {
if (data) {