refactoring-backend #3
@@ -244,7 +244,9 @@ Issues are grouped by category and ordered roughly by severity. Each entry descr
|
||||
|
||||
---
|
||||
|
||||
### TASK-013 — Consolidate `api/config.ts` and `api/file_config.ts` duplicate functions
|
||||
### TASK-013 — Consolidate `api/config.ts` and `api/file_config.ts` duplicate functions (done)
|
||||
|
||||
**Where fixed:** `frontend/src/api/config.ts`, `frontend/src/hooks/useFilterRawFile.ts`, `frontend/src/hooks/useActionRawFile.ts`, `frontend/src/components/config/JailFilesTab.tsx`, `frontend/src/components/config/ExportTab.tsx`
|
||||
|
||||
**Where found:** Both `frontend/src/api/config.ts` and `frontend/src/api/file_config.ts` export identical functions: `fetchJailConfigFiles`, `createJailConfigFile`, `fetchJailConfigFileContent`, `updateJailConfigFile`, `setJailConfigFileEnabled`, `fetchFilterFiles`, `fetchFilterFile`, `updateFilterFile`, `createFilterFile`, `fetchActionFiles`, `fetchActionFile`, `updateActionFile`, `createActionFile`.
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ vi.mock("../../api/config", () => ({
|
||||
updateParsedJailFile: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("../../api/file_config", () => ({
|
||||
vi.mock("../../api/config", () => ({
|
||||
fetchJailConfigFiles: mockFetchJailConfigFiles,
|
||||
createJailConfigFile: vi.fn().mockResolvedValue({
|
||||
name: "new-jail",
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
createFilterFile,
|
||||
updateActionFile,
|
||||
updateFilterFile,
|
||||
} from "../../api/file_config";
|
||||
} from "../../api/config";
|
||||
import { JailFilesTab } from "./JailFilesTab";
|
||||
import { ConfFilesTab } from "./ConfFilesTab";
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
createJailConfigFile,
|
||||
fetchJailConfigFiles,
|
||||
setJailConfigFileEnabled,
|
||||
} from "../../api/file_config";
|
||||
} from "../../api/config";
|
||||
import type { JailConfigFile } from "../../types/config";
|
||||
import { JailFileForm } from "./JailFileForm";
|
||||
import { useConfigStyles } from "./configStyles";
|
||||
|
||||
@@ -14,9 +14,6 @@ import type { FilterConfig, FilterListResponse } from "../../../types/config";
|
||||
|
||||
vi.mock("../../../api/config", () => ({
|
||||
fetchFilters: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("../../../api/file_config", () => ({
|
||||
fetchFilterFile: vi.fn(),
|
||||
updateFilterFile: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* React hook for loading and saving a single raw action file.
|
||||
*/
|
||||
import { useCallback } from "react";
|
||||
import { fetchActionFile, updateActionFile } from "../api/file_config";
|
||||
import { fetchActionFile, updateActionFile } from "../api/config";
|
||||
|
||||
export interface UseActionRawFileResult {
|
||||
fetchRawContent: () => Promise<string>;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* React hook for loading and saving a single raw filter file.
|
||||
*/
|
||||
import { useCallback } from "react";
|
||||
import { fetchFilterFile, updateFilterFile } from "../api/file_config";
|
||||
import { fetchFilterFile, updateFilterFile } from "../api/config";
|
||||
|
||||
export interface UseFilterRawFileResult {
|
||||
fetchRawContent: () => Promise<string>;
|
||||
|
||||
Reference in New Issue
Block a user