Support renaming multiple files at once

This commit is contained in:
Dane Everitt 2020-07-11 16:00:30 -07:00
parent 43f8ec23b8
commit 2653321fc2
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 35 additions and 29 deletions

View file

@ -5,11 +5,11 @@ interface Data {
renameTo: string;
}
export default (uuid: string, { renameFrom, renameTo }: Data): Promise<void> => {
export default (uuid: string, directory: string, files: Data[]): Promise<void> => {
return new Promise((resolve, reject) => {
http.put(`/api/client/servers/${uuid}/files/rename`, {
rename_from: renameFrom,
rename_to: renameTo,
root: directory,
files: files.map(f => ({ from: f.renameFrom, to: f.renameTo })),
})
.then(() => resolve())
.catch(reject);