import { useEffect } from "react"; import { useSearchParams, useNavigate } from "react-router-dom"; import { useProfileStore } from "../stores/useProfileStore"; export default function Pair() { const [params] = useSearchParams(); const navigate = useNavigate(); const { setGroupId } = useProfileStore(); const groupId = params.get("g"); useEffect(() => { if (groupId) { setGroupId(groupId); const t = setTimeout(() => navigate("/", { replace: true }), 1500); return () => clearTimeout(t); } }, [groupId, setGroupId, navigate]); if (!groupId) { return (
Invalid

This pairing link is malformed.

); } return (
Paired

Device linked

Your devices will recognize each other automatically from now on.

Redirecting…

); }