import styles from "../../css/AdminPanelCss/modal-style.module.css"; const AdminRecipeApplicationModal = ({ isOpen, onClose, setReload, recipeApplicationData }) => { if(!isOpen) return null; const { recipeName, recipeDesc, recipeCategory, recipeOrigin, recipeMealThumb, recipeYoutubeURL, ingredients } = recipeApplicationData const handleAccept = async () => { const token = localStorage.getItem("token"); const { id } = recipeApplicationData; try { const response = await fetch(`http://localhost:8080/api/admin/recipeapplication/accept/${id}`, { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }) if(response.ok) { await handleDecline(); } else { alert(response.status); } } catch (error) { console.log("some error occured bruv") console.error(error); } } const handleDecline = async () => { const token = localStorage.getItem("token"); const { id } = recipeApplicationData; try { const response = await fetch(`http://localhost:8080/api/admin/recipeapplication/decline/${id}`, { method: 'DELETE', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, }); if(response.ok) { setReload(true); onClose(); } else { alert(response.status); } } catch (error) { console.error(error); alert("Some error occurred while connecting with the server") } } return (

Recipe Details

Name: {recipeName}

Category: {recipeCategory}

Origin: {recipeOrigin}

Youtube Video URL: {recipeYoutubeURL}

Image URL: {recipeMealThumb}

Description: {recipeDesc}

Recipe Ingredients:

); } export default AdminRecipeApplicationModal;