-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example where next-auth works if local
- Loading branch information
Showing
14 changed files
with
373 additions
and
95 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use server'; | ||
|
||
import { getServerSession } from 'next-auth/next'; | ||
import { getSession } from '@/util/session'; | ||
|
||
export default async function ServerExample(message: string) { | ||
return await getServerSession({}); | ||
return await getSession(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use server'; | ||
|
||
import { getServerSession } from 'next-auth/next'; | ||
import { getSession } from '@/util/session'; | ||
|
||
export default async function ServerExample2(message: string) { | ||
return await getServerSession({}); | ||
return await getSession(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use server'; | ||
|
||
import { getServerSession } from 'next-auth/next'; | ||
import { getSession } from '@/util/session'; | ||
|
||
export default async function ServerExample(message: string) { | ||
return await getServerSession({}); | ||
return await getSession(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use client'; | ||
|
||
interface Props { | ||
action: (message: string) => Promise<any>; | ||
} | ||
|
||
export default function ClientExampleEmbeddedServer(props: Props) { | ||
return ( | ||
<button onClick={async () => console.log('ClientExampleEmbeddedServer', await props.action('hi'))}>client passed with shared server action: I will log</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use client'; | ||
|
||
import ServerExample from "./SharedServerExample"; | ||
|
||
export default function ClientImportsOwnServer() { | ||
return ( | ||
<button onClick={async () => console.log('ClientImportsOwnServer', await ServerExample('hi'))}>client importing shared server action: I will log</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use server'; | ||
|
||
import { __unstable__getSession } from "@/util/session"; | ||
|
||
export default async function ServerExample(message: string) { | ||
return await __unstable__getSession(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ClientExampleEmbeddedServer from "./ClientExampleEmbeddedServer" | ||
import ClientImportsOwnServer from "./ClientImportsOwnServer"; | ||
import ServerExample from "./SharedServerExample" | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
<ClientExampleEmbeddedServer action={ServerExample}/> | ||
<ClientImportsOwnServer /> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.