This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nextjs-auth0/app/profile/page.tsx
2024-07-07 17:47:57 +02:00

25 lines
523 B
TypeScript

'use client';
import { withPageAuthRequired } from '@auth0/nextjs-auth0/client';
import axios from 'axios';
import { useEffect, useState } from 'react';
export default withPageAuthRequired(function Profile() {
const [user, setUser] = useState();
useEffect(() => {
(async () => {
const response = await axios.get('/api/protected/profile');
setUser(response.data);
})();
}, []);
return (
<>
<h1>Profile (fetched from API)</h1>
{JSON.stringify(user, null, 2)}
</>
);
});