import { useRefererStore } from "@/stores/useRefererStore";
import { useEffect } from "react";

export default function useAddReferer() {
  const { setReferer } = useRefererStore();

  useEffect(() => {
    const referer = new URLSearchParams(window.location.search).get("ref");
    if (!referer) return;
    setReferer(referer);
  }, [setReferer]);

  return null;
}
