Properly normalize ssh key
This commit is contained in:
parent
462b3d637f
commit
fdd7b5b91b
|
@ -19,7 +19,6 @@ Adapter = ApplicationAdapter.extend
|
||||||
|
|
||||||
id = Ember.get(record, 'id')
|
id = Ember.get(record, 'id')
|
||||||
|
|
||||||
this.ajax(this.urlPrefix() + '/ssh_key/' + id, "PATCH", { data: data }).then (data) ->
|
this.ajax(this.urlPrefix() + '/ssh_key/' + id, "PATCH", { data: data })
|
||||||
data.ssh_key
|
|
||||||
|
|
||||||
`export default Adapter`
|
`export default Adapter`
|
||||||
|
|
|
@ -19,7 +19,9 @@ Route = TravisRoute.extend
|
||||||
fetchCustomSshKey: () ->
|
fetchCustomSshKey: () ->
|
||||||
repo = @modelFor('repo')
|
repo = @modelFor('repo')
|
||||||
self = this
|
self = this
|
||||||
@store.find('ssh_key', repo.get('id')).then ( (result) -> result unless result.get('isNew') ), (xhr) ->
|
@store.find('ssh_key', repo.get('id')).then ( (result) ->
|
||||||
|
result unless result.get('isNew')
|
||||||
|
), (xhr) ->
|
||||||
if xhr.status == 404
|
if xhr.status == 404
|
||||||
# if there is no model, just return null. I'm not sure if this is the
|
# if there is no model, just return null. I'm not sure if this is the
|
||||||
# best answer, maybe we should just redirect to different route, like
|
# best answer, maybe we should just redirect to different route, like
|
||||||
|
|
|
@ -3,5 +3,10 @@ import ApplicationSerializer from 'travis/serializers/application';
|
||||||
export default ApplicationSerializer.extend({
|
export default ApplicationSerializer.extend({
|
||||||
serialize(snapshot, options) {
|
serialize(snapshot, options) {
|
||||||
return { ssh_key: this._super(...arguments) };
|
return { ssh_key: this._super(...arguments) };
|
||||||
|
},
|
||||||
|
|
||||||
|
normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) {
|
||||||
|
payload = payload.ssh_key;
|
||||||
|
return this._super(store, primaryModelClass, payload, id, requestType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user