diff --git a/frontend/src/pages/presenters/usePresentersPage.js b/frontend/src/pages/presenters/usePresentersPage.js index deb4890..aac2957 100644 --- a/frontend/src/pages/presenters/usePresentersPage.js +++ b/frontend/src/pages/presenters/usePresentersPage.js @@ -11,7 +11,6 @@ export default function usePresenterPage() { useEffect(() => { if (teachersData == null) return; setTeachers(teachersData); - console.log(teachersData); }, [teachersData]); return { diff --git a/frontend/src/pages/workshops/useWorkshopsPage.js b/frontend/src/pages/workshops/useWorkshopsPage.js index 00794bf..baaa077 100644 --- a/frontend/src/pages/workshops/useWorkshopsPage.js +++ b/frontend/src/pages/workshops/useWorkshopsPage.js @@ -9,6 +9,7 @@ export default function useWorkshopsPage() { presentationsData, addToCartResponse, addItemToCart, + setAddToCartResponse, } = useAPI() const [parsedItemsList, setParsedItemsList] = useState() @@ -28,17 +29,22 @@ export default function useWorkshopsPage() { if (addToCartResponse == null) return const toastDataTemp = {} - switch (addToCartResponse.response.status) { + switch (addToCartResponse.status) { case 200: toastDataTemp.type = "success" toastDataTemp.message = "Item Successfully Added to Cart!" break; - default: + case 400: toastDataTemp.type = "error" - toastDataTemp.message = "Failed to Add Item to Cart!" + toastDataTemp.message = "Failed to Add Item to Cart: Item Is Already In Your Cart!" + break; + case 401: + toastDataTemp.type = "error" + toastDataTemp.message = "Failed to Add Item to Cart: You Should Login First!" } setToastData(toastDataTemp) setOpenToast(true) + setAddToCartResponse(null) }, [addToCartResponse]) useEffect(() => {