fix(frontend): query schemes by type
This commit is contained in:
@@ -79,18 +79,21 @@ const SchemeQuery: React.FC<Props> = ({
|
||||
const handleQuery = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const params: Record<string, string> = { network: NETWORK_NAME };
|
||||
const params: Record<string, string> = {
|
||||
network: NETWORK_NAME,
|
||||
scheme_type: "dma_leak_identification",
|
||||
};
|
||||
if (!queryAll && queryDate) {
|
||||
params.query_date = queryDate.startOf("day").toISOString();
|
||||
}
|
||||
const response = await api.get(`${config.BACKEND_URL}/api/v1/leakage/schemes/`, {
|
||||
const response = await api.get(`${config.BACKEND_URL}/api/v1/schemes`, {
|
||||
params,
|
||||
});
|
||||
const nextSchemes = response.data as LeakageSchemeRecord[];
|
||||
setSchemes(nextSchemes);
|
||||
if (nextSchemes.length === 0) {
|
||||
open?.({
|
||||
type: "error",
|
||||
type: "success",
|
||||
message: "查询结果",
|
||||
description: queryAll
|
||||
? "没有找到任何方案"
|
||||
@@ -117,8 +120,13 @@ const SchemeQuery: React.FC<Props> = ({
|
||||
const handleViewSchemeResult = async (schemeName: string) => {
|
||||
try {
|
||||
const response = await api.get(
|
||||
`${config.BACKEND_URL}/api/v1/leakage/schemes/${encodeURIComponent(schemeName)}`,
|
||||
{ params: { network: NETWORK_NAME } },
|
||||
`${config.BACKEND_URL}/api/v1/schemes/${encodeURIComponent(schemeName)}`,
|
||||
{
|
||||
params: {
|
||||
network: NETWORK_NAME,
|
||||
scheme_type: "dma_leak_identification",
|
||||
},
|
||||
},
|
||||
);
|
||||
onViewResult(response.data as LeakageResultDetail);
|
||||
} catch (error: any) {
|
||||
|
||||
Reference in New Issue
Block a user