rsnext/examples/with-supertokens/app/components/callApiButton.tsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
385 B
TypeScript
Raw Normal View History

"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>
);
};