Closed bjesuiter closed 1 year ago
AFAIK both middleware's should be called , since they are chainable. More complicated is the typing for this context, especially bc fresh is not smart enough to figure out the types as we go and add things to this context, so we have to manually type this out every time.
But, I also don't like the integration of the theme extraction in every file, so I also prefer a top-level middleware.
Maybe we can do the following: Add a top-level middleware with typing including only the theme variable.
Then we define the user area context to extend the top level context and add the user field there together with the other fields of this context.
Only thing then: All Usersrea routes must import the UserareaContext and all outside files must import the ToplevelContext, to have the correct types.
@Bloodiko I replaced all occurrences of getThemeOnServer with access to the context, either ToplevelContext or UserareaContext.
Anything under /userarea has the UserareaContext (includes the user) and anything above has the ToplevelContext.
I think, it's not the most elegant design, but the most practicable in the current state of the fresh framework. Please take a look again, whether you think it looks good.
@Bloodiko Bump 😀
Request for 2nd Review on this repo after integrating a new middleware structure for the theme variable
closes #15 fixes and closes #32