Simplify pusher handling in store
This commit is contained in:
parent
d7400c0567
commit
e161717f73
|
@ -74,14 +74,12 @@ Store = DS.Store.extend
|
||||||
job = @recordForId('job', data.id)
|
job = @recordForId('job', data.id)
|
||||||
job.appendLog(number: parseInt(data.number), content: data._log, final: data.final)
|
job.appendLog(number: parseInt(data.number), content: data._log, final: data.final)
|
||||||
else if data[name]
|
else if data[name]
|
||||||
@_loadOne(name, data)
|
@loadOne(name, data)
|
||||||
else
|
else
|
||||||
throw "can't load data for #{name}" unless type
|
throw "can't load data for #{name}" unless type
|
||||||
|
|
||||||
_loadOne: (type, json) ->
|
loadOne: (type, json) ->
|
||||||
payload = {}
|
record = @push(this.normalize(type, json))
|
||||||
payload[type.pluralize()] = [json[type]]
|
|
||||||
@push(this.normalize(type, json))
|
|
||||||
|
|
||||||
# we get other types of records only in a few situations and
|
# we get other types of records only in a few situations and
|
||||||
# it's not always needed to update data, so I'm specyfing which
|
# it's not always needed to update data, so I'm specyfing which
|
||||||
|
|
Loading…
Reference in New Issue
Block a user