This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
custom-ember-data-the-easy-way [2022/08/23 22:33] sausage Review suggestions from A.W. |
custom-ember-data-the-easy-way [2022/08/24 02:36] sausage Refactor once primaryKey is in place. |
||
---|---|---|---|
Line 554: | Line 554: | ||
normalizeFindRecordResponse(store, type, payload, id) { | normalizeFindRecordResponse(store, type, payload, id) { | ||
const alteredPayload = { | const alteredPayload = { | ||
- | game: { | + | game: { payload } |
- | id: payload.gameId, | + | |
- | title: payload.title, | + | |
- | year: payload.year | + | |
- | } | + | |
} | } | ||
return super.normalizeFindRecordResponse(store, type, alteredPayload, id); | return super.normalizeFindRecordResponse(store, type, alteredPayload, id); | ||
Line 574: | Line 570: | ||
</code> | </code> | ||
+ | |||
+ | Both functions are refactored with the introduction of the ''primaryKey'' property. Very handy! | ||
The errors and warnings are gone, and so therefore all that is left is to update our ''application.hbs'' template to ensure each record is rendered: | The errors and warnings are gone, and so therefore all that is left is to update our ''application.hbs'' template to ensure each record is rendered: |