fixed cache Refactoring from app router to page router Refactoring from app router to page router Add authentication with JWT base ui done protect the dashboard added transitions styling type trick added cleanup Add enable-disable logic add transactional emails Improvements on delay and frontend added description on select implement auth with magic link migrate to mariadb webhook signature working Adding async processing with queues Implemented webhook reply functionality Add son execution logs update status logic Add recent activity monitoring to sons show son performance in dashboard add readme implement listmonk connector listmonk-connector-v1 Create CODE_OF_CONDUCT.md Create LICENSE
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { useEffect } from "react";
|
|
import { useRouter } from "next/router";
|
|
import { useAuthContext } from "@/contexts/AuthContext";
|
|
import { useCustomToast } from "@/hooks/useCustomToast";
|
|
import { apiClient } from "@/lib/api-client";
|
|
|
|
const VerifyPage = () => {
|
|
const router = useRouter();
|
|
const { login } = useAuthContext();
|
|
const { showToast } = useCustomToast();
|
|
|
|
useEffect(() => {
|
|
const verifyToken = async () => {
|
|
const { token } = router.query;
|
|
if (token) {
|
|
try {
|
|
const response = await apiClient.get(`/auth/verify?token=${token}`);
|
|
await login(response.data.token, response.data.user);
|
|
showToast("Success", "Logged in successfully");
|
|
router.push("/");
|
|
} catch (error) {
|
|
console.error("Verification failed:", error);
|
|
showToast("Error", "Verification failed", "destructive");
|
|
router.push("/login");
|
|
}
|
|
}
|
|
};
|
|
|
|
verifyToken();
|
|
}, [router.query]);
|
|
|
|
return (
|
|
<div className="flex items-center justify-center h-screen">
|
|
<p>Verifying your magic link...</p>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
VerifyPage.layout = "minimal";
|
|
|
|
export default VerifyPage;
|