Assuming Posts belongsTo Category is it possible to patchEntity of existing Post with this:
{
"title": "foo",
"category": {
"id": 2,
"title": "new title for category 2"
}
}
| import ArraySchema from 'normalizr/lib/IterableSchema'; | |
| import { arrayOf } from 'normalizr'; | |
| export default function getTrimmedSchema(sourceSchema, maxDepth) { | |
| const resultSchema = new sourceSchema.constructor(sourceSchema._key, {idAttribute: sourceSchema._idAttribute}); | |
| defineAssocs(resultSchema, sourceSchema, maxDepth, 1); | |
| return resultSchema; | |
| } | |
| function defineAssocs(targetSchema, sourceSchema, maxDepth, currentDepth) { |
Assuming Posts belongsTo Category is it possible to patchEntity of existing Post with this:
{
"title": "foo",
"category": {
"id": 2,
"title": "new title for category 2"
}
}
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |