Skip to content

Commit

Permalink
Merge pull request #126 from lucyjemutai/email-verify
Browse files Browse the repository at this point in the history
user-verification
  • Loading branch information
CynthiaKamau authored Apr 30, 2024
2 parents 5d16df7 + 6e53d8f commit 32eb737
Show file tree
Hide file tree
Showing 2 changed files with 469 additions and 299 deletions.
9 changes: 5 additions & 4 deletions pages/auth/verifyEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import { useRouter } from "next/router";
import CircularProgress from "@mui/material/CircularProgress";
import Box from "@mui/material/Box";

export const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL;

const VerifyEmail = () => {
const router = useRouter();
const [loading, setLoading] = useState(true);

useEffect(() => {
const { token } = router.query;
const { path } = router.query;

// If token is present, send a request to backend API to verify the email
if (token) {
fetch(`/api/verify-email?token=${token}`)
if (path) {
fetch(`${API_BASE_URL}/users` + path)
.then((response) => {
if (response.ok) {
router.push("/auth/login");
Expand Down
Loading

0 comments on commit 32eb737

Please sign in to comment.