File tree Expand file tree Collapse file tree 3 files changed +9
-15
lines changed Expand file tree Collapse file tree 3 files changed +9
-15
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 6
6
7
7
import { Button , Flex } from "@radix-ui/themes" ;
8
8
import { useAuth } from "@workos-inc/authkit-nextjs/components" ;
9
- import { useEffect , useState } from "react" ;
10
- import { getSignInUrlAction } from "../actions/getSignInUrl" ;
11
9
import { handleSignOutAction } from "../actions/signOut" ;
12
10
13
11
export function SignInButton ( { large } : { large ?: boolean } ) {
14
12
const { user, loading } = useAuth ( ) ;
15
- const [ signInUrl , setSignInUrl ] = useState < string | undefined > ( undefined ) ;
16
-
17
- useEffect ( ( ) => {
18
- getSignInUrlAction ( ) . then ( setSignInUrl ) ;
19
- } , [ ] ) ;
20
13
21
14
if ( loading ) {
22
15
return < div > Loading...</ div > ;
@@ -36,7 +29,7 @@ export function SignInButton({ large }: { large?: boolean }) {
36
29
37
30
return (
38
31
< Button asChild size = { large ? "3" : "2" } >
39
- < a href = { signInUrl } > Sign In { large && "with AuthKit" } </ a >
32
+ < a href = "/login" > Sign In { large && "with AuthKit" } </ a >
40
33
</ Button >
41
34
) ;
42
35
}
Original file line number Diff line number Diff line change
1
+ import { getSignInUrl } from "@workos-inc/authkit-nextjs" ;
2
+ import { redirect } from "next/navigation" ;
3
+
4
+ export const GET = async ( ) => {
5
+ const signInUrl = await getSignInUrl ( ) ;
6
+
7
+ return redirect ( signInUrl ) ;
8
+ } ;
You can’t perform that action at this time.
0 commit comments