Skip to content

Commit

Permalink
Use ActionArgs instead of ActionFunction (#16)
Browse files Browse the repository at this point in the history
* chore: use `ActionArgs` instead of `ActionFunction`

* Update README.md

* Apply suggestions from code review

* Update README.md

Co-authored-by: Sergio Xalambrí <[email protected]>
  • Loading branch information
MichaelDeBoey and sergiodxa authored Sep 26, 2022
1 parent e3bd8ea commit 389b194
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ authenticator.use(
);
```

In order to authenticate a user, you can use the following inside of an ActionFunction:
In order to authenticate a user, you can use the following inside of an `action` function:

```ts
export const action: ActionFunction = async ({ request, context }) => {
export async function action({ context, request }: ActionArgs) {
return await authenticator.authenticate("form", request, {
successRedirect: "/",
failureRedirect: "/login",
Expand All @@ -81,7 +81,7 @@ export const action: ActionFunction = async ({ request, context }) => {
Because you may want to do validations or read valeus from the FormData before calling `authenticate`, the FormStrategy allows you to pass a FormData object as part of the optional context.

```ts
export const action: ActionFunction = async ({ request, context }) => {
export async function action({ context, request }: ActionArgs) {
let formData = await request.formData();
return await authenticator.authenticate("form", request, {
// use formData here
Expand Down

0 comments on commit 389b194

Please sign in to comment.