/* eslint-disable @typescript-eslint/no-explicit-any */ import axios from 'axios' export function getJson>(url: string): Promise { return sendRequest(url, 'GET') as Promise } export function postJson(url: string, data?: Record): Promise> { return sendRequest(url, 'POST', data) } export async function sendRequest( url: string, method: 'GET' | 'POST', data?: Record, ): Promise> { const authorization = localStorage.getItem('apiKey') if (!authorization) { throw Error('API key not found in local storage') } const headers = { authorization, } const response = await axios(url, { method, headers, data, }) return response.data }