# getProjects()

## Syntax

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

This method is used to get all projects of user.

## Parameters

<table><thead><tr><th width="119">Name</th><th width="121">Type</th><th width="108">Required</th><th>Description</th></tr></thead><tbody><tr><td>page</td><td>number</td><td>No</td><td>The current page in pagination. The default value is 1.</td></tr><tr><td>pageSize</td><td>number</td><td>No</td><td>A number of items for each page. The default value is 5.</td></tr><tr><td>sortBy</td><td>string</td><td>No</td><td>The return value will be sorted by this param. The default value is "id:desc" - meaning that sort by descending id.</td></tr><tr><td>token</td><td>string</td><td>No</td><td>The authentication token response from Eueno API when login. After login, this token was saved in local storage with the name “eueno-token".</td></tr></tbody></table>

## Example

```javascript
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:

```javascript
{
    "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
    }
}
```
