remix-auth-form
remix-auth-form copied to clipboard
Example is incorrect
Hi @sergiodxa Thanks for making this library battle tested in production, but I have some issue with successRedirect, after I figured out, the problem is we need to throw the Response.
export async function action({
request,
}: ActionFunctionArgs): ActionReturnType {
try {
return await authenticator.authenticate("sk-user-pass", request, {
successRedirect: "/admin/dashboard",
throwOnError: true,
});
} catch (err) {
if (err instanceof Response) {
throw err;
}
return json({
error: (err as Error).message,
});
}
}
I think we need to improve the repository example.