dashpresshq/dashpress

View on GitHub
src/frontend/hooks/scripts/index.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { useRouter } from "next/router";

import { useAuthenticatedUserBag } from "@/frontend/hooks/auth/user.store";
import type { IEvaluateScriptContext } from "@/shared/types/forms";

export const useEvaluateScriptContext = (): IEvaluateScriptContext => {
  const router = useRouter();
  const authUser = useAuthenticatedUserBag();
  return {
    routeParams: router.query as Record<string, string>,
    auth: authUser.data,
  };
};