Update logic that handles creation of folders for a server
This commit is contained in:
parent
ec87330a81
commit
95d19bf09e
13 changed files with 116 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
import axios, {AxiosInstance, AxiosRequestConfig} from 'axios';
|
||||
import axios, {AxiosInstance} from 'axios';
|
||||
import {ServerApplicationCredentials} from "@/store/types";
|
||||
|
||||
// This token is set in the bootstrap.js file at the beginning of the request
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
}
|
||||
|
||||
this.isLoading = true;
|
||||
createFolder(this.server.uuid, this.credentials, `${this.fm.currentDirectory}/${this.folderName.replace(/^\//, '')}`)
|
||||
createFolder(this.server.uuid, this.fm.currentDirectory, this.folderName.replace(/^\//, ''))
|
||||
.then(() => {
|
||||
this.$emit('created', this.folderName.replace(/^\//, ''));
|
||||
this.onModalClose();
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue