1.0.11 • Published 10 months ago
http-ed v1.0.11
Method
Repository method
Function | Description |
---|---|
getRequest(url: string): Promise<any> | Sends a GET request to the specified URL. |
postRequest(url: string, body: any): Promise<any> | Sends a POST request to the specified URL with the data in the body. |
getRequestBearer(url: string, token: string): Promise<any> | Sends an authenticated GET request to the specified URL with the provided token. |
postRequestBearer(url: string, token: string, body: any): Promise<any> | Sends an authenticated POST request to the specified URL with the data in the body and the provided token. |
Example
import { postRequest } from "http-ed";
export const fetchData = async (payload) => {
let url = `your api`;
return postRequest(url, payload.body);
};