Skip to content

Commit

Permalink
update success tip when create task info return
Browse files Browse the repository at this point in the history
  • Loading branch information
anny1021 committed Nov 15, 2023
1 parent 3eec557 commit bfc9eb5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/page/SqlAuditRecord/Create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useCurrentProjectName } from '../../ProjectManage/ProjectDetail';
import AuditResult from '../../Order/AuditResult';
import sql_audit_record from '../../../api/sql_audit_record';
import { ICreateSQLAuditRecordV1Params } from '../../../api/sql_audit_record/index.d';
import { useRef, useState } from 'react';
import { useRef, useState, useEffect } from "react";
import { IAuditTaskResV1, ISQLAuditRecordResData } from '../../../api/common';
import { ResponseCode } from '../../../data/common';
import EmptyBox from '../../../components/EmptyBox';
Expand Down Expand Up @@ -65,8 +65,6 @@ const SQLAuditCreate: React.FC = () => {
return updateTags(res.data.data, baseValues);
} else {
setTask(res.data.data.task);
message.success(t('sqlAudit.create.SQLInfo.successTips'));
scrollToAuditResult();
}
}
});
Expand All @@ -85,8 +83,6 @@ const SQLAuditCreate: React.FC = () => {
.then((res) => {
if (res.data.code === ResponseCode.SUCCESS) {
setTask(record.task);
message.success(t('sqlAudit.create.SQLInfo.successTips'));
scrollToAuditResult();
}
});
};
Expand All @@ -97,6 +93,13 @@ const SQLAuditCreate: React.FC = () => {
setTask(undefined);
};

useEffect(() => {

Check warning on line 96 in src/page/SqlAuditRecord/Create/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
if (typeof task?.task_id === 'number') {
message.success(t("sqlAudit.create.SQLInfo.successTips"));

Check warning on line 98 in src/page/SqlAuditRecord/Create/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
scrollToAuditResult();

Check warning on line 99 in src/page/SqlAuditRecord/Create/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 100 in src/page/SqlAuditRecord/Create/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 100 in src/page/SqlAuditRecord/Create/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}, [task, t]);

Check warning on line 101 in src/page/SqlAuditRecord/Create/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

return (
<>
<PageHeader title={t('sqlAudit.create.title')} ghost={false}>
Expand Down

0 comments on commit bfc9eb5

Please sign in to comment.