1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/models/invite.js

33 lines
839 B
JavaScript

import Model, {attr, belongsTo} from '@ember-data/model';
import {inject as service} from '@ember/service';
export default Model.extend({
token: attr('string'),
email: attr('string'),
expires: attr('number'),
createdAtUTC: attr('moment-utc'),
createdBy: attr('number'),
updatedAtUTC: attr('moment-utc'),
updatedBy: attr('number'),
status: attr('string'),
role: belongsTo('role', {async: false}),
ajax: service(),
ghostPaths: service(),
resend() {
let inviteData = {
email: this.email,
role_id: this.role.id
};
let inviteUrl = this.get('ghostPaths.url').api('invites');
return this.ajax.post(inviteUrl, {
data: JSON.stringify({invites: [inviteData]}),
contentType: 'application/json'
});
}
});