2022-04-10 18:26:47 +00:00
|
|
|
import { useSession, signIn, signOut } from "next-auth/react";
|
2022-04-11 17:52:22 +00:00
|
|
|
import { useEffect, useState } from "react";
|
2022-04-10 18:26:47 +00:00
|
|
|
import styles from "../styles/Components.module.css";
|
|
|
|
|
2022-04-17 01:14:14 +00:00
|
|
|
export default function UserInfo(props) {
|
2022-04-10 18:26:47 +00:00
|
|
|
const { data: session } = useSession();
|
2022-04-17 01:14:14 +00:00
|
|
|
const { borderData } = props;
|
2022-04-11 17:52:22 +00:00
|
|
|
|
2022-04-10 18:26:47 +00:00
|
|
|
return (
|
2022-04-16 22:29:21 +00:00
|
|
|
<div>
|
|
|
|
<p className={styles.description}>
|
|
|
|
{session
|
|
|
|
? `Signed in as ${session.user.name} (${borderData?.discordId})`
|
|
|
|
: "Not signed in"}
|
|
|
|
<br />
|
|
|
|
{session ? (
|
|
|
|
<button onClick={() => signOut()}>Sign Out</button>
|
|
|
|
) : (
|
|
|
|
<button onClick={() => signIn()}>Sign In</button>
|
|
|
|
)}
|
|
|
|
</p>
|
2022-04-11 17:52:22 +00:00
|
|
|
</div>
|
2022-04-10 18:26:47 +00:00
|
|
|
);
|
|
|
|
}
|