Zyle Moore
08/18/2025, 1:55 AMformData in a react router action? If I call args.request.formData(), it complains that it can only be called from a suspend function. ActionLike can only be boolean | ActionFunction<Context> . I'm able to work around it slightly with flatThen on formDataAsync, but I wouldn't want to do that with more than 2-3 `await`s, which makes me think I'm missing something.turansky
08/18/2025, 9:29 AMZyle Moore
08/18/2025, 3:02 PMturansky
08/18/2025, 3:58 PMZyle Moore
08/19/2025, 2:59 AMturansky
08/22/2025, 2:15 PMturansky
08/29/2025, 7:58 PMZyle Moore
08/30/2025, 12:45 AMunsafeJso {
path = Site.AUTHENTICATE
action = ActionFunction<Response> { args, handlerCtx ->
val formData = args.request.formData()
console.log("action", formData)
val pilotName = formData.get("pilotName")
val password = formData.get("password")
// do some stuff
PromiseResult(redirect(Site.TimeCards.OVERVIEW))
}
Component = CredentialSelector
}
Thanks for the quick turnaround @turansky!Zyle Moore
08/30/2025, 12:50 AMaction = ActionFunction<Response>(::authenticate)
suspend fun <Context> authenticate(args: ActionFunctionArgs<Context>, handlerCtx: Any?): DataFunctionValue {
val formData = args.request.formData()
console.log("action", formData)
val pilotName = formData.get("pilotName")
val password = formData.get("password")
// do some stuff
return PromiseResult(redirect(Site.TimeCards.OVERVIEW))
}turansky
08/30/2025, 9:04 AMturansky
08/30/2025, 9:05 AMZyle Moore
09/01/2025, 9:15 PMturansky
09/02/2025, 11:43 AMturansky
09/02/2025, 11:44 AMZyle Moore
09/07/2025, 11:13 PM