createFolder()

Syntax

createFolder(folderName: string, token: string, currentPathArray: string[])

Create new folder in a project or a parent folder.

Parameters

NameTypeRequiredDescription

folderName

string

Yes

The name of folder.

token

string

No

The authentication token response from Eueno API when login. After login, this token was saved in local storage with the name “eueno-token".

currentPathArray

array

Yes

Array includes projectId and parents folder's name. If we join array with slash “/”, we will get the path to access the new folder.

Example

import { createFolder } from "@eueno/lib-browser"; 

let folderName = "NewFolder";
let currentPathArray = ["112", "ParentFolder"]; // 112 is projectId

const onSubmit = async () => {
   try {
     const response = await createFolder(folderName, token, currentPathArray);
     if (response?.status == 200) {
       console.log("Folder created");
     }
   } catch (error) {
     console.error(error);
   }
 };

Response of example:

{
     "name": "NewFolder",
     "path": "ParentFolder/NewFolder"
}

Last updated