pageProps in middleware
Answered
ELY posted this in #help-forum
ELYOP
Hey !
I'm tring to retrieve some data from my page inside a middleware like that :
Is it even possible ? I pretty sure that was possible in previous next version is it still the case ? if not i'm open to suggestion !
Thank you !
I'm tring to retrieve some data from my page inside a middleware like that :
'use client';
import React from 'react';
function Protected(): React.ReactNode {
return (
<main>
<div>
<p>Protected</p>
</div>
</main>
);
}
Protected.authentication = true;
export default Protected;export const createAuthenticationMiddleware = (): MiddlewareFunction =>
(req, evt) => {
// Retrieving authentication from my page
...Is it even possible ? I pretty sure that was possible in previous next version is it still the case ? if not i'm open to suggestion !
Thank you !
Answered by Arinji
you cant pass data between the middleware and pages directly atleast
4 Replies
you cant pass data between the middleware and pages directly atleast
Answer
you can use headers though, so in the middleware set a header and have the page look for it
but you cant send stuff from pages to it, since it runs before every request.. not after
ELYOP
make sense ty for your response !