getProjects()

Syntax

get projects: (
  page?: number,
  pageSize?: number,
  sortBy?: string,
  token?: string
)

This method is used to get all projects of user.

Parameters

NameTypeRequiredDescription

page

number

No

The current page in pagination. The default value is 1.

pageSize

number

No

A number of items for each page. The default value is 5.

sortBy

string

No

The return value will be sorted by this param. The default value is "id:desc" - meaning that sort by descending id.

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".

Example

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

const getList = async () => {
   try {
     const page = 1;
     const PAGE_SIZE = 10;
     
     const response = await getProjects(page, PAGE_SIZE);
     if (response?.data?.data) {
       console.log(response.data);
     }
   } catch (error) {
     console.error(error);
   }
 };

Response of example:

{
    "msg": "success",
    "data": [
        {
            "id": 102,
            "name": "Oraichain US",
            "ownerAddress": "0x8bf5bf899059cde0e9770f4740fa9c8f6f5d07f9",
            "totalFile": "3",
            "totalSize": "0",
            "createdAt": "2023-03-02T06:48:23.968Z",
            "updatedAt": "2023-03-20T05:10:05.853Z"
        },
        {
            "id": 96,
            "name": "Kawaiiverse",
            "ownerAddress": "0x8bf5bf899059cde0e9770f4740fa9c8f6f5d07f9",
            "totalFile": "6",
            "totalSize": "7309338",
            "createdAt": "2023-02-28T04:47:28.802Z",
            "updatedAt": "2023-03-20T05:10:05.836Z"
        }
    ],
    "options": {
        "totalItems": 2
    }
}

Last updated