From 547dadb92549d82995f8749143f09f4901a7fd2f Mon Sep 17 00:00:00 2001 From: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> Date: Mon, 3 Nov 2025 11:24:52 +0800 Subject: [PATCH] Revert "refactor:batch rename and remove (#174)" This reverts commit 90c85970674b71c9df09363f6dfd707e6c4f0a50. --- src/pages/home/toolbar/BatchRename.tsx | 2 +- src/pages/home/toolbar/Delete.tsx | 5 +---- src/types/obj.ts | 6 ------ src/utils/api.ts | 13 ++----------- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/pages/home/toolbar/BatchRename.tsx b/src/pages/home/toolbar/BatchRename.tsx index 13c0ae046..7452c838f 100644 --- a/src/pages/home/toolbar/BatchRename.tsx +++ b/src/pages/home/toolbar/BatchRename.tsx @@ -143,7 +143,7 @@ export const BatchRename = () => { const renameObj: RenameObj = { src_name: obj.name, - new_name: srcName() + tempNum + (suffix == "" ? "" : "." + suffix), + new_name: srcName() + tempNum + "." + suffix, } tempNum = (parseInt(tempNum) + 1) .toString() diff --git a/src/pages/home/toolbar/Delete.tsx b/src/pages/home/toolbar/Delete.tsx index 75c1c6ba4..6666dca08 100644 --- a/src/pages/home/toolbar/Delete.tsx +++ b/src/pages/home/toolbar/Delete.tsx @@ -54,10 +54,7 @@ export const Delete = () => { onClick={async () => { const resp = await ok( pathname(), - selectedObjs().map((obj) => ({ - id: obj.id, - name: obj.name, - })), + selectedObjs().map((obj) => obj.name), ) handleRespWithNotifySuccess(resp, () => { refresh() diff --git a/src/types/obj.ts b/src/types/obj.ts index 8f41b79f3..5eae4ad80 100644 --- a/src/types/obj.ts +++ b/src/types/obj.ts @@ -11,7 +11,6 @@ export enum ObjType { } export interface Obj { - id: string name: string size: number is_dir: boolean @@ -28,11 +27,6 @@ export type StoreObj = Obj & { selected?: boolean } -export type IDName = { - id: string - name: string -} - export type RenameObj = { src_name: string new_name: string diff --git a/src/utils/api.ts b/src/utils/api.ts index a9234d85f..f22415076 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -9,7 +9,6 @@ import { RenameObj, ArchiveMeta, ArchiveList, - IDName, } from "~/types" import { r } from "." @@ -105,16 +104,8 @@ export const fsCopy = ( return r.post("/fs/copy", { src_dir, dst_dir, names, overwrite }) } -export const fsRemove = (dir: string, names: IDName[]): PEmptyResp => { - return r.post( - "/fs/remove", - { names }, - { - headers: { - "File-Path": encodeURIComponent(dir), - }, - }, - ) +export const fsRemove = (dir: string, names: string[]): PEmptyResp => { + return r.post("/fs/remove", { dir, names }) } export const fsRemoveEmptyDirectory = (src_dir: string): PEmptyResp => {