import { Base_URL } from "../../app.config";
import { createRequest } from "./create";
import { token } from "../logic";


const Instance = createRequest({
  baseURL: Base_URL,
  token: token
})

export default Instance;

export function Get<R, T>(url: string, config?: Omit<IRequestConfig<R, T>, 'url' | 'method' | 'data'>) {
  return Instance<R, T>({ ...config, url, method: 'GET' })
}

export function Post<R, T>(url: string, data?: IRequestConfig<R, T>['data'], config?: Omit<IRequestConfig<R, T>, 'url' | 'method' | 'data'>) {
  return Instance<R, T>({ ...config, url, method: 'POST', data })
}