Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/.env
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 8 additions & 0 deletions client/src/components/GsapPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -35,6 +36,13 @@ export default function GsapPage() {
<Route path="/signup" element={
<ProtectedRoute children={<Signup />} requiresAuth={false} />
} />
<Route
path="/verify-email"
element={
<ProtectedRoute children={<VerifyEmail />} requiresAuth={false} />
}
/>

<Route path="/seller/profile" element={<ProtectedRoute children={<SellerDashboard />} />} />
<Route path="/buyer/profile" element={<ProtectedRoute children={<BuyerDashboard />} />} />
</Routes>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const Navbar = () => {
{/* logo and site name */}
<div className="flex justify-between items-center">
{/* I will add the image here later */}
<img src="/picprismlogo.png" alt="our logo" className="w-[50px]" />

<Link to="/" className="font-bold text-3xl">
PicPrism
</Link>
Expand Down
38 changes: 38 additions & 0 deletions client/src/components/VerifyEmail.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex items-center justify-center h-screen bg-gray-100">
<div className="p-6 bg-white rounded shadow">
<h1 className="text-xl font-bold mb-4">Email Verification</h1>
<p>{message}</p>
</div>
</div>
);
};

export default VerifyEmail;
30 changes: 6 additions & 24 deletions client/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,8 @@ export default function Home() {
type="button"
class="absolute inset-y-0 end-0 flex items-center pe-3"
>
<svg
class="w-4 h-4 text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 16 20"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M15 7v3a5.006 5.006 0 0 1-5 5H6a5.006 5.006 0 0 1-5-5V7m7 9v3m-3 0h6M7 1h2a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V4a3 3 0 0 1 3-3Z"
/>
</svg>
</button>
</div>
<button
type="submit"
class="inline-flex items-center py-2.5 px-3 ms-2 text-sm font-medium text-white bg-blue-700 rounded-lg border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
>
<svg

<svg
class="w-4 h-4 me-2"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -91,8 +71,10 @@ export default function Home() {
d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
/>
</svg>
Search
</button>

</button>
</div>

</form>
</div>
</>
Expand Down
9 changes: 4 additions & 5 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -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();

Expand Down Expand Up @@ -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,
}));

Expand Down