Support renaming multiple files at once
This commit is contained in:
parent
43f8ec23b8
commit
2653321fc2
6 changed files with 35 additions and 29 deletions
17
resources/scripts/api/server/files/renameFiles.ts
Normal file
17
resources/scripts/api/server/files/renameFiles.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import http from '@/api/http';
|
||||
|
||||
interface Data {
|
||||
renameFrom: string;
|
||||
renameTo: string;
|
||||
}
|
||||
|
||||
export default (uuid: string, directory: string, files: Data[]): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.put(`/api/client/servers/${uuid}/files/rename`, {
|
||||
root: directory,
|
||||
files: files.map(f => ({ from: f.renameFrom, to: f.renameTo })),
|
||||
})
|
||||
.then(() => resolve())
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue