mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
d1f57a2569
Conflicts: Gruntfile.js core/client/models/post.js core/client/models/settings.js core/client/models/user.js core/client/router.js package.json
32 lines
887 B
JavaScript
32 lines
887 B
JavaScript
/*global Ghost,Backbone */
|
|
(function () {
|
|
'use strict';
|
|
|
|
Ghost.Models.User = Ghost.ProgressModel.extend({
|
|
url: Ghost.paths.apiRoot + '/users/me/',
|
|
|
|
parse: function (resp) {
|
|
// unwrap user from {users: [{...}]}
|
|
if (resp.users) {
|
|
resp = resp.users[0];
|
|
}
|
|
|
|
return resp;
|
|
},
|
|
|
|
sync: function (method, model, options) {
|
|
// wrap user in {users: [{...}]}
|
|
if (method === 'create' || method === 'update') {
|
|
options.data = JSON.stringify({users: [this.attributes]});
|
|
options.contentType = 'application/json';
|
|
}
|
|
|
|
return Backbone.Model.prototype.sync.apply(this, arguments);
|
|
}
|
|
});
|
|
|
|
// Ghost.Collections.Users = Backbone.Collection.extend({
|
|
// url: Ghost.paths.apiRoot + '/users/'
|
|
// });
|
|
|
|
}()); |