ms.bind('ms.page_loaded', function (event) {
if (ms.substore && ms.substore.alias) {
localStorage.setItem("substore", ms.substore.alias)
}
if (ms.substore || !localStorage.getItem("substore") || !localStorage.getItem("substore").length) {
return;
}
var req = {
entity: 'ms.settings',
customCommandName: '',
data: {
"store": localStorage.getItem("substore")
}
}
ms.app.call('setPreferences', req, function (err, response) {
if (!err) location.reload();
})
})