Add support for renaming files on the fly in the file manager
This commit is contained in:
parent
52115b5c77
commit
ff820f30ad
10 changed files with 230 additions and 37 deletions
|
@ -1,27 +1,13 @@
|
|||
import {ServerApplicationCredentials} from "@/store/types";
|
||||
import http from "@/api/http";
|
||||
import {AxiosError, AxiosRequestConfig} from "axios";
|
||||
import {ServerData} from "@/models/server";
|
||||
import {withCredentials} from "@/api/http";
|
||||
|
||||
/**
|
||||
* Connects to the remote daemon and creates a new folder on the server.
|
||||
*/
|
||||
export function createFolder(server: ServerData, credentials: ServerApplicationCredentials, path: string): Promise<void> {
|
||||
const config: AxiosRequestConfig = {
|
||||
baseURL: credentials.node,
|
||||
headers: {
|
||||
'X-Access-Server': server.uuid,
|
||||
'X-Access-Token': credentials.key,
|
||||
},
|
||||
};
|
||||
|
||||
export function createFolder(server: string, credentials: ServerApplicationCredentials, path: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post('/v1/server/file/folder', { path }, config)
|
||||
.then(() => {
|
||||
resolve();
|
||||
})
|
||||
.catch((error: AxiosError) => {
|
||||
reject(error);
|
||||
});
|
||||
withCredentials(server, credentials).post('/v1/server/file/folder', { path })
|
||||
.then(() => resolve())
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
|
Reference in a new issue