mirror of
https://github.com/haiwen/seahub.git
synced 2025-06-03 20:41:20 +00:00
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
define([
|
|
'underscore',
|
|
'backbone',
|
|
'common',
|
|
], function(_, Backbone, Common) {
|
|
'use strict';
|
|
|
|
var Device = Backbone.Model.extend({
|
|
unlink: function(options) {
|
|
var data = {
|
|
'platform': this.get('platform'),
|
|
'device_id': this.get('device_id'),
|
|
'user': this.get('user')
|
|
};
|
|
if (options.wipe_device) {
|
|
data['wipe_device'] = 'true';
|
|
}
|
|
|
|
$.ajax({
|
|
url: Common.getUrl({name: 'admin-devices'}),
|
|
type: 'DELETE',
|
|
dataType: 'json',
|
|
beforeSend: Common.prepareCSRFToken,
|
|
data: data,
|
|
success: function() {
|
|
if (options.success) {
|
|
options.success();
|
|
}
|
|
},
|
|
error: function(xhr) {
|
|
if (options.error) {
|
|
options.error(xhr);
|
|
}
|
|
},
|
|
complete: function(xhr) {
|
|
if (options.complete) {
|
|
options.complete(xhr);
|
|
}
|
|
}
|
|
});
|
|
},
|
|
});
|
|
|
|
return Device;
|
|
});
|