You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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 }