Solid
Way to pass data between route middleware and page
I am trying to make a authentication middleware and because I am looking for something very specific I cannot resort to already made tools. The basic gist of it, like many auth middlewares, is to route to a 'login' page if the user has no permission and route to the right page if the user does have permission.
I managed to get this far, but the issue now comes when I want to add content to this page that also varies depending on the user (some users have permission to see certain things). My thought was that I could pass this 'session' to the page from the middleware. I have tried things like setting context, meta and also useState. None of them seem to work.
It is required that the user MUST NOT get to edit and SHOULD NOT see the data that is passed from the middleware to the page
At this point I don't even know if it is possible. The documentation on middleware isn't incredibly extensive and not many people have made tutorials on it. My own attempts have not yet gotten me any further. I am asking as a last resort before rethinking my website architecture
5 replies