import { ActionFunctionArgs } from "react-router"; import { buildRemindCookie } from "~/services/auth/password-policy-banner.server"; import { requireUserId } from "~/utils/session.server"; // Phase 01 / #27 — resource route powering the "Remind me in 7 days" // button on the password-policy soft-banner. Sets a UX cookie that the // tenant layout consults before rendering the banner. The cookie is NOT a // security control — it is purely a dismissal UX, so SameSite=Lax / // non-httpOnly is fine. // // Lives under /auth/* (a public-web-route prefix) because the host-routing // runtime rejects every other /api/* path on the tenant app host with 404 — // see isRemovedLegacyRoute in server/host-routing-runtime.ts. export const action = async ({ request }: ActionFunctionArgs) => { await requireUserId(request); return Response.json( { ok: true }, { headers: { "Set-Cookie": buildRemindCookie(), }, } ); }; // Defensive: GET requests should not toggle state. Return 405 so the route // stays POST-only. export const loader = () => new Response("Method Not Allowed", { status: 405, headers: { Allow: "POST" } });