How do you obtain customer information in a JavaScript module?

How do you obtain customer information in a JavaScript module?
A. Magento does not expose customer information in JavaScript for security reasons
B. By sending an AJAX request to the url: /customer/account/info/?json=1
C. By using customerData.get(‘customer’) call, where customerData is an instance of Magento_Customer/js/customer-data
D. Customer information is available in localStorage and be retrieved by calling window.localStorage.getItem(‘customer’)

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “How do you obtain customer information in a JavaScript module?

  1. Answer:- C

    define([
    ‘uiComponent’,
    ‘Magento_Customer/js/customer-data’
    ], function (Component, customerData) {
    ‘use strict’;

    return Component.extend({
    initialize: function () {
    this._super();
    this.customer = customerData.get(‘customer’);
    }
    });
    });

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.