import { AxiosRequestConfig, AxiosResponse } from 'axios' import { isBrowser } from '../utils' import { publicRequest } from './publicRequest' export const addToCart = async ( id: string | number, data: ICartRequestData ): Promise => { const response: AxiosResponse = await publicRequest.post( `v1/event/${id}/add-to-cart/`, { data }, { headers: { ...publicRequest.defaults.headers.common, 'Referer-Url': isBrowser ? document.referrer : '', }, } ) return response.data } export const getCart = async (): Promise => { const response: AxiosResponse = await publicRequest.get(`v1/cart`) return response.data }