dev
This commit is contained in:
61
domain-web/src/api/modules.ts
Normal file
61
domain-web/src/api/modules.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import http from "./http";
|
||||
|
||||
export const authApi = {
|
||||
login: (payload: { username: string; password: string }) => http.post("/auth/login", payload)
|
||||
};
|
||||
|
||||
export const dashboardApi = {
|
||||
overview: () => http.get("/dashboard/overview")
|
||||
};
|
||||
|
||||
export const runtimeApi = {
|
||||
status: () => http.get("/runtime/status"),
|
||||
preflight: () => http.get("/runtime/preflight"),
|
||||
action: (action: string) => http.post(`/runtime/actions/${action}`)
|
||||
};
|
||||
|
||||
export const settingsApi = {
|
||||
getSettings: () => http.get("/settings"),
|
||||
updateSettings: (payload: Record<string, unknown>) => http.put("/settings", payload),
|
||||
exportSettings: () => http.get("/settings/export"),
|
||||
importSettings: (payload: Record<string, unknown>) => http.post("/settings/import", payload),
|
||||
validateImportSettings: (payload: Record<string, unknown>) => http.post("/settings/validate-import", payload),
|
||||
backupSettings: () => http.post("/settings/backup"),
|
||||
getSettingsBackups: () => http.get("/settings/backups"),
|
||||
backupDownloadUrl: (filename: string) =>
|
||||
`${(import.meta.env.VITE_API_BASE_URL || "http://127.0.0.1:8100/api/v1").replace(/\/api\/v1\/?$/, "")}/api/v1/settings/backups/download/${encodeURIComponent(filename)}`
|
||||
};
|
||||
|
||||
export const importsApi = {
|
||||
summary: () => http.get("/imports/summary"),
|
||||
tasks: () => http.get("/imports/tasks"),
|
||||
retry: (taskId: string) => http.post(`/imports/tasks/${taskId}/retry`),
|
||||
upload: (formData: FormData) =>
|
||||
http.post("/imports/upload", formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
export const detectApi = {
|
||||
status: () => http.get("/detect/status"),
|
||||
start: () => http.post("/detect/start"),
|
||||
stop: () => http.post("/detect/stop")
|
||||
};
|
||||
|
||||
export const domainsApi = {
|
||||
filters: () => http.get("/domains/filters"),
|
||||
list: (params?: Record<string, unknown>) => http.get("/domains", { params }),
|
||||
batchUpdate: (payload: Record<string, unknown>) => http.post("/domains/batch-update", payload)
|
||||
};
|
||||
|
||||
export const exportsApi = {
|
||||
list: () => http.get("/exports"),
|
||||
run: (payload: Record<string, unknown>) => http.post("/exports/run", payload)
|
||||
};
|
||||
|
||||
export const logsApi = {
|
||||
latest: () => http.get("/logs/latest"),
|
||||
bundleUrl: () => `${(import.meta.env.VITE_API_BASE_URL || "http://127.0.0.1:8100/api/v1").replace(/\/api\/v1\/?$/, "")}/api/v1/logs/bundle`
|
||||
};
|
||||
Reference in New Issue
Block a user