Update logic that handles creation of folders for a server

This commit is contained in:
Dane Everitt 2019-05-01 21:45:39 -07:00
parent ec87330a81
commit 95d19bf09e
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
13 changed files with 116 additions and 9 deletions

View file

@ -1,12 +1,13 @@
import {ServerApplicationCredentials} from "@/store/types";
import {withCredentials} from "@/api/http";
import http from "@/api/http";
/**
* Connects to the remote daemon and creates a new folder on the server.
*/
export function createFolder(server: string, credentials: ServerApplicationCredentials, path: string): Promise<void> {
export function createFolder(server: string, directory: string, name: string): Promise<void> {
return new Promise((resolve, reject) => {
withCredentials(server, credentials).post('/v1/server/file/folder', { path })
http.post(`/api/client/servers/${server}/files/create-folder`, {
directory, name,
})
.then(() => resolve())
.catch(reject);
});