createProject()

Syntax

createProject(data: NewProject, token: string)

This method is used when you want to create a new project.

Parameters

The interface of NewProject looks as below

interface NewProject {
 name: string; //Project name
}

Returns

Promise returns a JSON - project info:

  • totalFile: The number of files/folders in the project

  • totalSize: The project size (bytes)

  • id: The project id

  • name: The project name

  • ownerAddress: The address of the Owallet account which created the project

  • updatedAt: The last date time update project

  • createdAt: The date-time create the project

Example

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

const onSubmit = async (data) => {
   const response = await createProject(data, token);
   if (response?.status == 200) {
     console.log(response);
     toast.success("Project created!");
   } else {
     toast.error(response || "An error occurred, please try again later");
   }
 };

Response of example:

    "data": {
        "totalFile": "0",
        "totalSize": "0",
        "id": 1,
        "name": "ProjectName",
        "ownerAddress": "0x…",
        "updatedAt": "2023-03-08T10:43:53.677Z",
        "createdAt": "2023-03-08T10:43:53.677Z"
    }

Last updated