From d45db1527a201d0b1ca74e72adb820791b803c19 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Fri, 12 Aug 2022 23:00:59 +0300 Subject: [PATCH] Redirect to event page after reporting winners --- TODO.md | 4 ++-- app/routes/calendar/$id/report-winners.tsx | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index ebcce550e..0cebe4c4c 100644 --- a/TODO.md +++ b/TODO.md @@ -23,8 +23,8 @@ Calendar ## Other -- [ ] Refactor Avatar to accept player object instead of separate fields -- [ ] Redirect to event page after submitting results +- [ ] can submit results with one invalid linked user +- [x] Redirect to event page after submitting results - [x] date input take in account time zone difference between server and client - [x] User selector allow passing users from top level - [x] Constants use CALENDAR_EVENT object diff --git a/app/routes/calendar/$id/report-winners.tsx b/app/routes/calendar/$id/report-winners.tsx index 763dd3afb..a01d82cd3 100644 --- a/app/routes/calendar/$id/report-winners.tsx +++ b/app/routes/calendar/$id/report-winners.tsx @@ -1,4 +1,9 @@ -import { type ActionFunction, type LoaderArgs, json } from "@remix-run/node"; +import { + type ActionFunction, + type LoaderArgs, + json, + redirect, +} from "@remix-run/node"; import { Form, useLoaderData } from "@remix-run/react"; import { z } from "zod"; import { Label } from "~/components/Label"; @@ -22,6 +27,7 @@ import { FormMessage } from "~/components/FormMessage"; import { FormErrors } from "~/components/FormErrors"; import type { UseDataFunctionReturn } from "@remix-run/react/dist/components"; import type { Unpacked } from "~/utils/types"; +import { calendarEventPage } from "~/utils/urls"; const playersSchema = z .array( @@ -114,7 +120,7 @@ export const action: ActionFunction = async ({ request, params }) => { })), }); - return null; + return redirect(calendarEventPage(parsedParams.id)); }; export const handle = {