Should I use a "Provider" type service just to check if the user is logged in?

Asked

Viewed 36 times

0

I have an application that makes use of the module ngRoute.

When the url of a restricted page is accessed, I check if the user is logged in, and then allow access. Only I was replicating this routine in various parts of my code. So I thought, I’m going to encapsulate this in a service. But for my unhappiness services like factory and service are not accessible in the block config of my module. So I thought I’d use the provider.

But there it is. This is the only way to separate my checking routine or is there any form that is more trivial?

  • Why not use Sessionstorage or Localstorage?

  • @Diegoaugusto, the problem is that it is not accessible in the 'config' block'

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.