borders/components/userInfo.js

25 lines
675 B
JavaScript
Raw Normal View History

2022-04-10 18:26:47 +00:00
import { useSession, signIn, signOut } from "next-auth/react";
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-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>
</div>
2022-04-10 18:26:47 +00:00
);
}