import _User from './_User.js'; var _FrameAdminListItem = {}; _FrameAdminListItem.update = function(frame, property, value){ var properties_to_update = {}; properties_to_update[property] = value; return m.request({ method: 'POST', url: '/cgi/updateitem', body: { session_hash: _User.session_hash, item_id: frame.id, properties_to_update: properties_to_update } }) .then(function(res){ if(res.success === true){ frame[property] = value; } }); }; _FrameAdminListItem.delete = function(frame, collection, index_in_collection){ return m.request({ method: 'POST', url: '/cgi/deleteitem', body: { session_hash: _User.session_hash, item_id: frame.id } }) .then(function(res){ if(res.success === true){ _DB.removeRecord(frame); collection.splice(index_in_collection, 1); } }); }; export default _FrameAdminListItem;