define([
'Magento_Ui/js/form/form',
'Magento_Customer/js/customer-data'
], function (Component, customerData) {
'use strict';
return Component.extend({
isLoggedIn: function () {
this.customer = customerData.get('customer');
if (!this.customer().firstname) {
return false;
}
return true;
}
});
}
When the customer login and the customer data is being loaded by ajax from server, isLoggedIn
returns false
.
But this is not correct as the customer has logged in and local-storage update is in progress.
How to get the logged in state while data is loading from server in 'customer-data.js'?