Closed luoage closed 7 years ago
Yes, it needs to be called each request because you need to know which user is logged in each route's action. Total.js supports these flags:
authorize
for logged usersunauthorize
for unlogged usersFor understanding:
Imagine we have an eshop application which have pages for all users and logged users. Homepage has to be rendered for all users (logged and unlogged together). But if some user is logged, you need to show his name in e.g. layout
--> so for this case is needed to execute F.onAuthorize
too. Current solution will work because F.onAuthorize
is executed for all (controlller's) routes.
Solution for you:
F.onAuthorize
create own middleware
Do you understand?
Oh, great thx !
I have a simple authorization, so I rewrite F.onAuthorize
And add flag to parameter.
But when I open my index page that the page has no authorize flag, F.onAuthorize is called.
So, is that right ? I just want it called when the flags has authorize, how to make it possible ?