91444dfef8
This PR fixes how a protected API is called once the user is logged in, in the `with-supertokens` example app. Co-authored-by: Sam Ko <sam@vercel.com>
17 lines
385 B
TypeScript
17 lines
385 B
TypeScript
"use client";
|
|
|
|
import styles from "../page.module.css";
|
|
|
|
export const CallAPIButton = () => {
|
|
const fetchUserData = async () => {
|
|
const userInfoResponse = await fetch("http://localhost:3000/api/user");
|
|
|
|
alert(JSON.stringify(await userInfoResponse.json()));
|
|
};
|
|
|
|
return (
|
|
<div onClick={fetchUserData} className={styles.sessionButton}>
|
|
Call API
|
|
</div>
|
|
);
|
|
};
|