diff --git a/donutshop_ecommerce/src/app/api/auth/[...nextauth]/route.js b/donutshop_ecommerce/src/app/api/auth/[...nextauth]/route.js index 4721a21..fe7bd04 100644 --- a/donutshop_ecommerce/src/app/api/auth/[...nextauth]/route.js +++ b/donutshop_ecommerce/src/app/api/auth/[...nextauth]/route.js @@ -22,7 +22,7 @@ export const authOptions = { username: { label: "Email", type: "email", placeholder: "test@example.com" }, password: { label: "Password", type: "password" } }, - async authorize(credentials, req) { + async authorize(credentials, req) { const email = credentials?.email; const password = credentials?.password; diff --git a/donutshop_ecommerce/src/app/menu/page.js b/donutshop_ecommerce/src/app/menu/page.js index 8dcf1c4..9f1e4e4 100644 --- a/donutshop_ecommerce/src/app/menu/page.js +++ b/donutshop_ecommerce/src/app/menu/page.js @@ -1,9 +1,72 @@ -import React from 'react' +"use client" +import React, { useEffect, useState } from 'react' +import Menu from '../../components/menu/Menu'; +import Slider from "react-slick"; +import "slick-carousel/slick/slick.css"; +import "slick-carousel/slick/slick-theme.css"; const MenuPage = () => { + const [categories, setCategories] = useState([]); + const [menuItems, setMenuItems] = useState([]); + + useEffect(() => { + fetch('/api/categories').then(res => { + res.json().then(categories => setCategories(categories)) + }); + fetch('/api/menu-items').then(res => { + res.json().then(menuItems => setMenuItems(menuItems)) + }); + + }, []); + + //slider + var menuSlide = { + dots: false, + infinite: false, + speed: 500, + slidesToShow: 2, + responsive: [ + { + breakpoint: 640, + settings: { + slidesToShow: 2, + slidesToScroll: 2, + infinite: true, + dots: false + } + }, + { + breakpoint: 480, + settings: { + slidesToShow: 1, + slidesToScroll: 1 + } + } + ] + }; + + return ( -
{c.name}
+{itemName}
+{description}
+${basePrice}
+ +