export async function customFetch(
  endpoint: string,
  data?: any,
  method?: string
) {
  if (method && (method === 'GET' || method === 'DELETE')) {
    return await fetch(`http://localhost:8000/${endpoint}`, {
      method: method,
      headers: { 'Content-Type': 'application/json' },
    });
  } else {
    return await fetch(`http://localhost:8000/${endpoint}`, {
      method: method ?? 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(data ? data : {}),
    });
  }
}
