import {GET, POST} from "@/shared/api/apiClient";
import {CHECKOUT, USER_ORDERS} from "@/shared/constants";
import {GetUserOrderByIdResponse, GetUserOrdersResponse} from "@/shared/types/userOrders";

export const getUserOrders = async ():Promise<GetUserOrdersResponse>=>{
  const {data} = await GET<GetUserOrdersResponse>(USER_ORDERS)
  return data
}

export const getUserOrdersById = async (id: number):Promise<GetUserOrderByIdResponse>=>{
  const {data} = await GET<GetUserOrderByIdResponse>(`${USER_ORDERS}/${id}`)
  return data
}

export const createUserOrder = async (data: any)=>{
  const res = await POST(CHECKOUT, data)
  return res
}