"use client"; import { useLoginModal } from "@/app/LoginModalContext"; import { useAuthContext } from "@/app/AuthContext"; export function useAuthAction() { const { openLoginModal } = useLoginModal(); const { did } = useAuthContext(); return (action: (...args: Args) => Promise) => async (...args: Args): Promise => { if (did) { return action(...args); } else { openLoginModal(); return undefined; } }; }