Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

guards.js 536B

12345678910111213141516171819202122
  1. import { currentProfile } from '../services'
  2. const checkLoginStatus = (destination, nextCb) => {
  3. console.warn('currentProfile logged in:', currentProfile.isLoggedIn())
  4. if (
  5. destination.meta.requiresCompleteProfile &&
  6. currentProfile.isLoggedIn() &&
  7. !currentProfile.isComplete()
  8. ) {
  9. nextCb('survey')
  10. } else if(
  11. destination.meta.requiresAuth &&
  12. !currentProfile.isLoggedIn()
  13. ) {
  14. nextCb('login')
  15. } else {
  16. nextCb()
  17. }
  18. }
  19. export { checkLoginStatus }