File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
_official-jokes/app/routes
combobox-resource-route/app/routes Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff 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" ||
Original file line number Diff line number Diff line change 66 ComboboxPopover ,
77} from "@reach/combobox" ;
88import comboboxStyles from "@reach/combobox/styles.css" ;
9- import type { LinksFunction } from "@remix-run/react " ;
9+ import type { LinksFunction } from "@remix-run/node " ;
1010import { Form , useFetcher , useSearchParams } from "@remix-run/react" ;
1111
1212import type { Lang } from "~/models/langs" ;
You can’t perform that action at this time.
0 commit comments