简体   繁体   中英

User status in SCA shopping

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}}

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')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM