Vinoteca: wine shop on 1C-Bitrix (module, template, components, pages)
This commit is contained in:
commit
52795535ae
586 files changed
+27619
No files matched your search
@@ -0,0 +1,20 @@
|
||||
(function () {
|
||||
if (!window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
var pending = null;
|
||||
window.VinoState = {
|
||||
first: function (name) {
|
||||
if (!pending) {
|
||||
pending = new Promise(function (resolve) {
|
||||
BX.ajax.runAction('jinove:vinoteca.state.all', { method: 'GET' }).then(
|
||||
function (response) { resolve((response && response.data) || {}); },
|
||||
function () { resolve({}); }
|
||||
);
|
||||
});
|
||||
}
|
||||
return pending.then(function (all) {
|
||||
if (!all[name]) throw new Error('state');
|
||||
return { data: all[name] };
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in new issue
Block a user