Skip to content

Commit

Permalink
Update Types in readme code snippets (#260)
Browse files Browse the repository at this point in the history
Update README.md

update readme file code snippets to use consistent types.
  • Loading branch information
shyamlohar committed Dec 3, 2023
1 parent 7f0f4bc commit 1d9ae20
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ if (user) {
Once the user is ready to leave the application, we can call the `logout` method inside an action.

```ts
export async function action({ request }: ActionArgs) {
export async function action({ request }: ActionFunctionArgs) {
await authenticator.logout(request, { redirectTo: "/login" });
};
```
Expand All @@ -185,7 +185,7 @@ If we do not pass the `successRedirect` option to the `authenticator.authenticat
Note that we will need to store the user data in the session this way. To ensure we use the correct session key, the authenticator has a `sessionKey` property.

```ts
export async function action({ request }: ActionArgs) {
export async function action({ request }: ActionFunctionArgs) {
let user = await authenticator.authenticate("user-pass", request, {
failureRedirect: "/login",
});
Expand Down Expand Up @@ -234,7 +234,7 @@ Furthermore, we can read the error using that key after a failed authentication.

```ts
// in the loader of the login route
export async function loader({ request }: LoaderArgs) {
export async function loader({ request }: LoaderFunctionArgs) {
await authenticator.isAuthenticated(request, {
successRedirect: "/dashboard",
});
Expand Down Expand Up @@ -271,7 +271,7 @@ Alternatively, we can do it on the action itself.
```ts
import { AuthorizationError } from "remix-auth";

export async function action({ request }: ActionArgs) {
export async function action({ request }: ActionFunctionArgs) {
try {
return await authenticator.authenticate("user-pass", request, {
successRedirect: "/dashboard",
Expand Down

0 comments on commit 1d9ae20

Please sign in to comment.