async function getLessons() {
const response = await fetch("API_URL/lessons", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
search: "",
sortBy: "subject",
sortOrder: "asc",
}),
});
return await response.json();
}
async function rateLesson() {
const response = await fetch("API_URL/lessons/rate", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
lessonId: "12as1541sa",
rating: 5,
}),
});
return await response.json();
}
async function submitOrder() {
const response = await fetch("API_URL/order/new", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
username: "amaan",
phone: 123456,
booked_lessons: [
{
_id: "as461as86d41",
quantity: 1,
total: 100,
},
],
total_price: 100,
}),
});
return await response.json();
}
async function getOrders() {
const response = await fetch("API_URL/order/myorders", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
search: "",
}),
});
return await response.json();
}
These actions are password protected.