chore(frontend): fix HeroUI deps and apply lint cleanup

This commit is contained in:
sagit
2026-02-13 07:25:27 +00:00
parent 641aa66afc
commit 3b294c6b9e
6 changed files with 673 additions and 428 deletions
+29 -19
View File
@@ -1,3 +1,5 @@
import axios from "axios";
import Network from "./network";
// 登陆相关接口
@@ -42,9 +44,17 @@ export const checkNodeStatus = (nodeId?: number) => {
};
export const upgradeNode = (id: number, version?: string) =>
Network.post("/node/upgrade", { id, version: version || "" }, { timeout: 5 * 60 * 1000 });
Network.post(
"/node/upgrade",
{ id, version: version || "" },
{ timeout: 5 * 60 * 1000 },
);
export const batchUpgradeNodes = (ids: number[], version?: string) =>
Network.post("/node/batch-upgrade", { ids, version: version || "" }, { timeout: 15 * 60 * 1000 });
Network.post(
"/node/batch-upgrade",
{ ids, version: version || "" },
{ timeout: 15 * 60 * 1000 },
);
export const getNodeReleases = () => Network.post("/node/releases");
export const rollbackNode = (id: number) =>
Network.post("/node/rollback", { id });
@@ -224,12 +234,8 @@ export const resetPeerShareFlow = (id: number) =>
Network.post("/federation/share/reset-flow", { id });
export const getPeerRemoteUsageList = () =>
Network.post("/federation/share/remote-usage/list");
export const importRemoteNode = (data: {
remoteUrl: string;
token: string;
}) => Network.post("/federation/node/import", data);
import axios from "axios";
export const importRemoteNode = (data: { remoteUrl: string; token: string }) =>
Network.post("/federation/node/import", data);
export interface BackupTypes {
users?: boolean;
@@ -247,19 +253,25 @@ export interface BackupTypes {
export const exportBackup = async (types: string[] = []) => {
const token = window.localStorage.getItem("token");
const baseURL = axios.defaults.baseURL || "/api/v1/";
const response = await axios.post(`${baseURL}/backup/export`, { types }, {
headers: {
Authorization: token,
"Content-Type": "application/json",
const response = await axios.post(
`${baseURL}/backup/export`,
{ types },
{
headers: {
Authorization: token,
"Content-Type": "application/json",
},
responseType: "blob",
},
responseType: "blob",
});
);
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement("a");
link.href = url;
const timestamp = new Date().toISOString().slice(0, 19).replace(/[:-]/g, "");
link.setAttribute("download", `backup_${timestamp}.json`);
document.body.appendChild(link);
link.click();
@@ -267,7 +279,5 @@ export const exportBackup = async (types: string[] = []) => {
window.URL.revokeObjectURL(url);
};
export const importBackup = (data: {
types: string[];
[key: string]: any;
}) => Network.post("/backup/import", data);
export const importBackup = (data: { types: string[]; [key: string]: any }) =>
Network.post("/backup/import", data);