Skip to content

Commit e0fe074

Browse files
committed
fixes
Signed-off-by: Logan McAnsh <[email protected]>
1 parent 08727c0 commit e0fe074

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

_official-jokes/app/routes/login.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ function validatePassword(password: string) {
3636
}
3737
}
3838

39-
function validateUrl(url: FormDataEntryValue) {
40-
if (typeof url !== "string") return;
39+
function validateUrl(url: FormDataEntryValue | null) {
40+
if (typeof url !== "string") return "/jokes";
4141
const urls = ["/jokes", "/", "https://remix.run"];
42-
if (urls.includes(url)) {
43-
return url;
44-
}
42+
if (urls.includes(url)) return url;
4543
return "/jokes";
4644
}
4745

@@ -50,9 +48,7 @@ export const action = async ({ request }: ActionArgs) => {
5048
const loginType = form.get("loginType");
5149
const password = form.get("password");
5250
const username = form.get("username");
53-
const redirectTo = validateUrl(
54-
(form.get("redirectTo") as string) || "/jokes"
55-
);
51+
const redirectTo = validateUrl(form.get("redirectTo"));
5652
if (
5753
typeof loginType !== "string" ||
5854
typeof password !== "string" ||

combobox-resource-route/app/routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
ComboboxPopover,
77
} from "@reach/combobox";
88
import comboboxStyles from "@reach/combobox/styles.css";
9-
import type { LinksFunction } from "@remix-run/react";
9+
import type { LinksFunction } from "@remix-run/node";
1010
import { Form, useFetcher, useSearchParams } from "@remix-run/react";
1111

1212
import type { Lang } from "~/models/langs";

0 commit comments

Comments
 (0)