import { useLocation } from "@tanstack/react-router";
import { safeReturnPath } from "~/lib/return-to";
/** Search params for the sign-in and sign-up links, returning the visitor to the current page afterwards. */
export function useReturnSearch(path?: string): { next?: string } {
const location = useLocation();
const next = safeReturnPath(path ?? location.href);
return next ? { next } : {};
}