const API_URL = "http://127.0.0.1:8000/orders";

export async function getOrders() {
	const res = await fetch(API_URL);
	return res.json();
}

export async function getOrder(orderId: number) {
	const res = await fetch(`${API_URL}/${orderId}`);
	return res.json();
}

export async function createOrder(orderData: any) {
	const res = await fetch(API_URL, {
		method: "POST",
		headers: { "Content-Type": "application/json" },
		body: JSON.stringify(orderData),
	});
	return res.json();
}
