hedera-web/js/hedera/basket-checker.js

26 lines
508 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
2019-05-21 14:16:27 +00:00
module.exports = {
2022-11-16 01:46:44 +00:00
check(conn, hash, callback) {
2022-05-30 01:30:33 +00:00
this.hash = hash;
2019-05-21 14:16:27 +00:00
conn.execQuery('CALL myBasket_check',
this._onBasketCheck.bind(this, callback));
},
2016-09-26 09:28:47 +00:00
2022-11-16 01:46:44 +00:00
_onBasketCheck(callback, resultSet) {
2019-05-21 14:16:27 +00:00
var status = resultSet.fetchValue();
2016-09-26 09:28:47 +00:00
if (!status)
return;
var isOk = status == 'UPDATED' || status == 'OK';
if (status == 'UPDATED')
2019-05-21 14:16:27 +00:00
Htk.Toast.showWarning(_('Order items updated'));
2016-09-26 09:28:47 +00:00
if (callback)
2019-05-21 14:16:27 +00:00
callback(isOk);
2016-09-26 09:28:47 +00:00
if (!isOk)
2022-05-30 01:30:33 +00:00
this.hash.setAll({form: 'ecomerce/checkout'});
2016-09-26 09:28:47 +00:00
}
};