deleteFile()

Syntax

deleteFile(file_id: string | number, token?: string)

Delete the file by id.

Parameters

Name
Type
Required
Description

file_id

string or number

Yes

The file 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 { deleteFile } from "@eueno/lib-browser";
 
const handleDeleteFile = async () => {
   if (!token) return toast.error("Token null!");
   try {
     const id =220428”;
     const res = await deleteFile(id);
     if (res.status === 200) {
       console.log("Delete successfully");
     }
   } catch (error) {
     console.error(error);
   }
 };

Response of example:

{
    "msg": "success"
}

Last updated