Skip to content

Instantly share code, notes, and snippets.

View TLTechbender's full-sized avatar
😎
Day by Day, Night by Night, I'm steady learning 🙏🏾.

Bolarinwa TLTechbender

😎
Day by Day, Night by Night, I'm steady learning 🙏🏾.
View GitHub Profile
export default async function client(endpoint: string, { body, customConfig = {} }: { body?: any, customConfig?: RequestInit } = {}): Promise<void> {
const API_URL = "import.meta.env.API_URL"
const headers = { 'content-type': 'application/json' };
const config= {
method: body ? 'POST' : 'GET',
...customConfig,
headers: {
...headers,
...customConfig.headers,
},