mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-17 13:53:45 +02:00
Add basic file deletion logic
This commit is contained in:
14
resources/assets/scripts/api/server/files/deleteElement.ts
Normal file
14
resources/assets/scripts/api/server/files/deleteElement.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import {withCredentials} from "@/api/http";
|
||||
import {ServerApplicationCredentials} from "@/store/types";
|
||||
|
||||
/**
|
||||
* Deletes files and/or folders from the server. You should pass through an array of
|
||||
* file or folder paths to be deleted.
|
||||
*/
|
||||
export function deleteElement(server: string, credentials: ServerApplicationCredentials, items: Array<string>): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
withCredentials(server, credentials).post('/v1/server/file/delete', { items })
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user