Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/home/toolbar/BatchRename.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const BatchRename = () => {

const renameObj: RenameObj = {
src_name: obj.name,
new_name: srcName() + tempNum + "." + suffix,
new_name: srcName() + tempNum + (suffix == "" ? "" : "." + suffix),
}
tempNum = (parseInt(tempNum) + 1)
.toString()
Expand Down
5 changes: 4 additions & 1 deletion src/pages/home/toolbar/Delete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export const Delete = () => {
onClick={async () => {
const resp = await ok(
pathname(),
selectedObjs().map((obj) => obj.name),
selectedObjs().map((obj) => ({
id: obj.id,
name: obj.name,
})),
)
handleRespWithNotifySuccess(resp, () => {
refresh()
Expand Down
6 changes: 6 additions & 0 deletions src/types/obj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum ObjType {
}

export interface Obj {
id: string
name: string
size: number
is_dir: boolean
Expand All @@ -24,6 +25,11 @@ export type StoreObj = Obj & {
selected?: boolean
}

export type IDName = {
id: string
name: string
}

export type RenameObj = {
src_name: string
new_name: string
Expand Down
13 changes: 11 additions & 2 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
RenameObj,
ArchiveMeta,
ArchiveList,
IDName,
} from "~/types"
import { r } from "."

Expand Down Expand Up @@ -104,8 +105,16 @@ export const fsCopy = (
return r.post("/fs/copy", { src_dir, dst_dir, names, overwrite })
}

export const fsRemove = (dir: string, names: string[]): PEmptyResp => {
return r.post("/fs/remove", { dir, names })
export const fsRemove = (dir: string, names: IDName[]): PEmptyResp => {
return r.post(
"/fs/remove",
{ names },
{
headers: {
"File-Path": encodeURIComponent(dir),
},
},
)
}

export const fsRemoveEmptyDirectory = (src_dir: string): PEmptyResp => {
Expand Down