Pro Ember Data by David Tang

Pro Ember Data by David Tang

Author:David Tang
Language: eng
Format: epub
ISBN: 9781484265611
Publisher: Apress


Next up, we will tackle updateRecord().

Implementing updateRecord()

In our previous adapter, updateRecord() made a PUT request with the updated data and responded with a payload structured the same as createRecord(). With our Local Storage adapter, the id of the record will be used to find it in Local Storage. If found, the new properties will be set and the data will be written back to Local Storage. A fulfilled promise will be returned with the data. If the resource isn’t found, a rejected promise will be returned:app/adapters/local-storage.js

import Adapter from '@ember-data/adapter';

import { resolve, reject } from 'rsvp';

import { pluralize } from 'ember-inflector';



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.