This repository has been archived on 2025-05-09. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Astral-nook/resources/scripts/api/server/files/renameFiles.ts
2020-07-11 16:00:30 -07:00

17 lines
482 B
TypeScript

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);
});
};