some api routes
This commit is contained in:
parent
6591e0987f
commit
6e58f59274
39 changed files with 324 additions and 21 deletions
25
components/userInfo.js
Normal file
25
components/userInfo.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { useSession, signIn, signOut } from "next-auth/react";
|
||||
import styles from "../styles/Components.module.css";
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
return {
|
||||
props: {
|
||||
borderInfo,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function UserInfo(borderInfo) {
|
||||
const { data: session } = useSession();
|
||||
return (
|
||||
<p className={styles.description}>
|
||||
{session ? `Signed in as ${session.user.name}` : "Not signed in"}
|
||||
<br />
|
||||
{session ? (
|
||||
<button onClick={() => signOut()}>Sign Out</button>
|
||||
) : (
|
||||
<button onClick={() => signIn()}>Sign In</button>
|
||||
)}
|
||||
</p>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue