diff --git a/.env b/.env deleted file mode 100644 index 195967ea4..000000000 --- a/.env +++ /dev/null @@ -1,13 +0,0 @@ -# Public Environment Variables -NEXT_PUBLIC_CURRENCY=$ -NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY='' - -# Private Environment Variables -CLERK_SECRET_KEY='' -MONGODB_URI='' -INNGEST_SIGNING_KEY='' -INNGEST_EVENT_KEY='' -# Cloudinary -CLOUDINARY_CLOUD_NAME ='' -CLOUDINARY_API_KEY ='' -CLOUDINARY_API_SECRET ='' \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1b7a73ab0..e2764f949 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ yarn-error.log* .pnpm-debug.log* # env files (can opt-in for committing if needed) -# .env* +.env* # vercel .vercel @@ -39,3 +39,6 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# clerk configuration (can include secrets) +/.clerk/ diff --git a/app/3d-printed-products/page.jsx b/app/3d-printed-products/page.jsx new file mode 100644 index 000000000..69b5ad73e --- /dev/null +++ b/app/3d-printed-products/page.jsx @@ -0,0 +1,16 @@ +"use client"; + +import { useEffect } from "react"; +import { useRouter } from "next/navigation"; +import { ALL_3D_PRINTED_SLUG, getCategoryPagePath } from "@/lib/productCategories"; + +/** Redirect legacy URL to the all-3D-printed shop category page */ +export default function ThreeDPrintedProductsRedirect() { + const router = useRouter(); + + useEffect(() => { + router.replace(getCategoryPagePath(ALL_3D_PRINTED_SLUG)); + }, [router]); + + return null; +} diff --git a/app/3d-printing-filament/page.jsx b/app/3d-printing-filament/page.jsx new file mode 100644 index 000000000..764c80f6d --- /dev/null +++ b/app/3d-printing-filament/page.jsx @@ -0,0 +1,16 @@ +"use client"; + +import { useEffect } from "react"; +import { useRouter } from "next/navigation"; +import { getCategoryPagePath } from "@/lib/productCategories"; + +/** Redirect legacy URL to the filament shop category page */ +export default function FilamentProductsRedirect() { + const router = useRouter(); + + useEffect(() => { + router.replace(getCategoryPagePath("3d-printing-filament")); + }, [router]); + + return null; +} diff --git a/app/add-address/page.jsx b/app/add-address/page.jsx index 4fdf10ac3..956c860f1 100644 --- a/app/add-address/page.jsx +++ b/app/add-address/page.jsx @@ -4,9 +4,13 @@ import Navbar from "@/components/Navbar"; import Footer from "@/components/Footer"; import Image from "next/image"; import { useState } from "react"; - +import { useAppContext } from "@/context/AppContext"; +import toast from "react-hot-toast"; +import axios from "axios"; const AddAddress = () => { + const {getToken , router} = useAppContext() + const [address, setAddress] = useState({ fullName: '', phoneNumber: '', @@ -18,8 +22,22 @@ const AddAddress = () => { const onSubmitHandler = async (e) => { e.preventDefault(); + try{ + const token = await getToken() + const {data} = await axios.post('/api/user/add-address', {address}, {headers : {Authorization: `Bearer ${token}`}}) + + if(data.success){ + toast.success(data.message) + router.push('/cart') + }else{ + toast.error( data.message) + } + - } + }catch(error){ + toast.error(error.message) + } + } return ( <> diff --git a/app/all-products/page.jsx b/app/all-products/page.jsx index 8a000adac..33b7d7716 100644 --- a/app/all-products/page.jsx +++ b/app/all-products/page.jsx @@ -1,28 +1,19 @@ 'use client' -import ProductCard from "@/components/ProductCard"; -import Navbar from "@/components/Navbar"; -import Footer from "@/components/Footer"; +import { useEffect } from "react"; import { useAppContext } from "@/context/AppContext"; +import { useRouter } from "next/navigation"; const AllProducts = () => { + const { setIsLoading } = useAppContext(); + const router = useRouter(); - const { products } = useAppContext(); + useEffect(() => { + // Redirect to 3D printed products page + setIsLoading(false); + router.push("/shop/all-3d-printed"); + }, [setIsLoading, router]); - return ( - <> - -
-
-

All products

-
-
-
- {products.map((product, index) => )} -
-
-