diff --git a/client/.env b/client/.env index f3e1b9e..d5c30e3 100644 --- a/client/.env +++ b/client/.env @@ -1,4 +1,4 @@ - VITE_API_URL="http://127.0.0.1:8000" + VITE_API_URL="http://127.0.0.1:8080" # VITE_API_URL="https://pic-prism-my-jngk.vercel.app" VITE_CLOUDINARY_API_KEY="918647814468562" VITE_CLOUDINARY_CLOUD_NAME="dde6ql8hv" diff --git a/client/src/components/GsapPage.jsx b/client/src/components/GsapPage.jsx index 2bfc25d..c1d30eb 100644 --- a/client/src/components/GsapPage.jsx +++ b/client/src/components/GsapPage.jsx @@ -4,6 +4,7 @@ import LogIn from '../pages/Login'; // Assuming LogIn is a default export import Signup from '../pages/Signup'; // Assuming Signup is a default export import SellerDashboard from '../pages/SellerDashboard'; import BuyerDashboard from '../pages/BuyerDashboard'; +import VerifyEmail from "../components/VerifyEmail"; // Assuming Home is a default export @@ -35,6 +36,13 @@ export default function GsapPage() { } requiresAuth={false} /> } /> + } requiresAuth={false} /> + } + /> + } />} /> } />} /> diff --git a/client/src/components/Navbar.jsx b/client/src/components/Navbar.jsx index 501d390..8f43039 100644 --- a/client/src/components/Navbar.jsx +++ b/client/src/components/Navbar.jsx @@ -212,7 +212,7 @@ const Navbar = () => { {/* logo and site name */}
{/* I will add the image here later */} - our logo + PicPrism diff --git a/client/src/components/VerifyEmail.jsx b/client/src/components/VerifyEmail.jsx new file mode 100644 index 0000000..ee486cd --- /dev/null +++ b/client/src/components/VerifyEmail.jsx @@ -0,0 +1,38 @@ +import React, { useEffect, useState } from "react"; +import axios from "axios"; +import { useSearchParams } from "react-router-dom"; + +const VerifyEmail = () => { + const [message, setMessage] = useState(""); + const [searchParams] = useSearchParams(); + + useEffect(() => { + const verifyEmail = async () => { + const token = searchParams.get("token"); + if (!token) { + setMessage("Invalid or missing token."); + return; + } + + try { + const res = await axios.get(`/api/auth/verify-email?token=${token}`); + setMessage(res.data.message); + } catch (error) { + setMessage(error.response?.data?.message || "An error occurred."); + } + }; + + verifyEmail(); + }, [searchParams]); + + return ( +
+
+

Email Verification

+

{message}

+
+
+ ); +}; + +export default VerifyEmail; diff --git a/client/src/pages/Home.jsx b/client/src/pages/Home.jsx index 1265a55..8a78d95 100644 --- a/client/src/pages/Home.jsx +++ b/client/src/pages/Home.jsx @@ -55,28 +55,8 @@ export default function Home() { type="button" class="absolute inset-y-0 end-0 flex items-center pe-3" > - - -
- + + + + diff --git a/server/index.js b/server/index.js index 476de32..987443d 100644 --- a/server/index.js +++ b/server/index.js @@ -1,12 +1,11 @@ - - const express = require('express'); const cors = require('cors'); const { readdirSync } = require('fs'); const path = require('path'); const { connectDb } = require('./db/connection'); require('dotenv').config(); -const PORT =8000; + + const app = express(); @@ -42,8 +41,8 @@ app.use(express.json()); app.use(cors({ - // origin: 'https://pic-prism-my.vercel.app', - origin: 'http://localhost:5173', + origin: 'https://pic-prism-my.vercel.app', + // origin: 'http://localhost:5173', credentials: true, }));