Laravel breeze nextjs and server side authentication request

110 views Asked by At

I created new project with Laravel breeze and next js. I used this official laravel boilerplate https://github.com/laravel/breeze-next. It's almost work perfectly but is there any way to check if user is authenticated in server side component?

This is simple example what I mean:

export default async function Me(){
const response = await axios.get('/api/test-data'); // this endpoint is protected by laravel sanctum
return (
    <div>
        Server side component - { response.data.length }
    </div>
)
0

There are 0 answers