0

Is there a simple way to check the user's logged in/out status in ALL areas of the SCA front-end? ie:

{{if isLoggedIn}}
    do this
{{else}}
    do that
{{/if}}
snieguu
  • 2,073
  • 2
  • 20
  • 39
kitecom
  • 1
  • 1

1 Answers1

0

depending on the version of SCA you are using you can use the global variable SC.

either

SC.PROFILE.isLoggedIn

or

SC.PROFILE_PROMISE.then(function(profile){
    console.log(profile.isLoggedIn);
});

You can also include the user profile in any of your models:

define(
    'MyModule'
,   [   'Profile.Model'

    ]
,   function (

        ProfileModel
    )
{
    'use strict';


    return {

        mountToApp: function(application){
           var profile_model = ProfileModel.getInstance();
            if (profile_model.get('isLoggedIn') === 'F')
bknights
  • 14,408
  • 2
  • 18
  • 31
  • Thanks @bknights, I'm using 2018.2 - can I assume that I need to create a ShoppingApplication@ override/Extension and introduce the profile model to that? – kitecom Nov 08 '18 at 11:28