简体   繁体   English

SCA购物中的用户状态

[英]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? 有没有一种简单的方法可以检查SCA前端的所有区域中用户的登录/注销状态? 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. 根据所使用的SCA版本,可以使用全局变量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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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