You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
947 B
JavaScript
41 lines
947 B
JavaScript
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; |