@@ -73,16 +73,8 @@ export const loader = authLoader({ returnPathname: '/dashboard' });
73
73
For pages where you want to display a signed-in and signed-out view, use ` withAuth ` to retrieve the user profile from WorkOS.
74
74
75
75
``` jsx
76
- import type {
77
- ActionFunctionArgs ,
78
- LoaderFunctionArgs ,
79
- } from ' @remix-run/node' ;
80
- import {
81
- Link ,
82
- useRouteLoaderData ,
83
- json ,
84
- Form ,
85
- } from ' @remix-run/react' ;
76
+ import type { ActionFunctionArgs , LoaderFunctionArgs } from ' @remix-run/node' ;
77
+ import { Link , useRouteLoaderData , json , Form } from ' @remix-run/react' ;
86
78
import { getSignInUrl , getSignUpUrl , withAuth , signOut } from ' @workos-inc/authkit-remix' ;
87
79
88
80
export async function loader ({ request }: LoaderFunctionArgs ) {
@@ -106,8 +98,8 @@ export default function HomePage() {
106
98
if (! user) {
107
99
return (
108
100
<>
109
- < Link href = {signInUrl}> Log in < / Link>
110
- < Link href = {signUpUrl}> Sign Up< / Link>
101
+ < Link to = {signInUrl}> Log in < / Link>
102
+ < Link to = {signUpUrl}> Sign Up< / Link>
111
103
< / >
112
104
);
113
105
}
@@ -126,7 +118,7 @@ export default function HomePage() {
126
118
For pages where a signed- in user is mandatory, you can use the ` ensureSignedIn` option:
127
119
128
120
` ` ` jsx
129
- const { user } = await withAuth({ ensureSignedIn: true });
121
+ const { user } = await withAuth(request, { ensureSignedIn: true });
130
122
` ` `
131
123
132
124
Enabling ` ensureSignedIn` will redirect users to AuthKit if they attempt to access the page without being authenticated.
0 commit comments