Skip to content

Commit

Permalink
doc: use store for save-record docs (#9299)
Browse files Browse the repository at this point in the history
doc: use store for save-record docs

removes this.store because the doc example is not inside a class for
rest, json-api and active-record
  • Loading branch information
Yelinz authored Mar 29, 2024
1 parent 2bf5b65 commit 72b1e21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions packages/active-record/src/-private/builders/save-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function isExisting(identifier: StableRecordIdentifier): identifier is StableExi
* ```ts
* import { deleteRecord } from '@ember-data/active-record/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
*
* // mark record as deleted
* store.deleteRecord(person);
Expand All @@ -59,7 +59,7 @@ function isExisting(identifier: StableRecordIdentifier): identifier is StableExi
* ```ts
* import { deleteRecord } from '@ember-data/active-record/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
*
* // mark record as deleted
* store.deleteRecord(person);
Expand Down Expand Up @@ -114,7 +114,7 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { createRecord } from '@ember-data/active-record/request';
*
* const person = this.store.createRecord('person', { name: 'Ted' });
* const person = store.createRecord('person', { name: 'Ted' });
* const data = await store.request(createRecord(person));
* ```
*
Expand All @@ -135,7 +135,7 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { createRecord } from '@ember-data/active-record/request';
*
* const person = this.store.createRecord('person', { name: 'Ted' });
* const person = store.createRecord('person', { name: 'Ted' });
* const options = createRecord(person, { namespace: 'api/v1' });
* const data = await store.request(options);
* ```
Expand Down Expand Up @@ -184,7 +184,7 @@ export function createRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { updateRecord } from '@ember-data/active-record/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
* person.name = 'Chris';
* const data = await store.request(updateRecord(person));
* ```
Expand All @@ -207,7 +207,7 @@ export function createRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { updateRecord } from '@ember-data/active-record/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
* person.name = 'Chris';
* const options = updateRecord(person, { patch: true });
* const data = await store.request(options);
Expand Down
12 changes: 6 additions & 6 deletions packages/json-api/src/-private/builders/save-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function isExisting(identifier: StableRecordIdentifier): identifier is StableExi
* ```ts
* import { deleteRecord } from '@ember-data/json-api/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
*
* // mark record as deleted
* store.deleteRecord(person);
Expand All @@ -58,7 +58,7 @@ function isExisting(identifier: StableRecordIdentifier): identifier is StableExi
* ```ts
* import { deleteRecord } from '@ember-data/json-api/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
*
* // mark record as deleted
* store.deleteRecord(person);
Expand Down Expand Up @@ -113,7 +113,7 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { createRecord } from '@ember-data/json-api/request';
*
* const person = this.store.createRecord('person', { name: 'Ted' });
* const person = store.createRecord('person', { name: 'Ted' });
* const data = await store.request(createRecord(person));
* ```
*
Expand All @@ -134,7 +134,7 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { createRecord } from '@ember-data/json-api/request';
*
* const person = this.store.createRecord('person', { name: 'Ted' });
* const person = store.createRecord('person', { name: 'Ted' });
* const options = createRecord(person, { namespace: 'api/v1' });
* const data = await store.request(options);
* ```
Expand Down Expand Up @@ -183,7 +183,7 @@ export function createRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { updateRecord } from '@ember-data/json-api/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
* person.name = 'Chris';
* const data = await store.request(updateRecord(person));
* ```
Expand All @@ -206,7 +206,7 @@ export function createRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { updateRecord } from '@ember-data/json-api/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
* person.name = 'Chris';
* const options = updateRecord(person, { patch: true });
* const data = await store.request(options);
Expand Down
12 changes: 6 additions & 6 deletions packages/rest/src/-private/builders/save-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function isExisting(identifier: StableRecordIdentifier): identifier is StableExi
* ```ts
* import { deleteRecord } from '@ember-data/rest/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
*
* // mark record as deleted
* store.deleteRecord(person);
Expand All @@ -59,7 +59,7 @@ function isExisting(identifier: StableRecordIdentifier): identifier is StableExi
* ```ts
* import { deleteRecord } from '@ember-data/rest/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
*
* // mark record as deleted
* store.deleteRecord(person);
Expand Down Expand Up @@ -114,7 +114,7 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { createRecord } from '@ember-data/rest/request';
*
* const person = this.store.createRecord('person', { name: 'Ted' });
* const person = store.createRecord('person', { name: 'Ted' });
* const data = await store.request(createRecord(person));
* ```
*
Expand All @@ -135,7 +135,7 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { createRecord } from '@ember-data/rest/request';
*
* const person = this.store.createRecord('person', { name: 'Ted' });
* const person = store.createRecord('person', { name: 'Ted' });
* const options = createRecord(person, { namespace: 'api/v1' });
* const data = await store.request(options);
* ```
Expand Down Expand Up @@ -184,7 +184,7 @@ export function createRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { updateRecord } from '@ember-data/rest/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
* person.name = 'Chris';
* const data = await store.request(updateRecord(person));
* ```
Expand All @@ -207,7 +207,7 @@ export function createRecord(record: unknown, options: ConstrainedRequestOptions
* ```ts
* import { updateRecord } from '@ember-data/rest/request';
*
* const person = this.store.peekRecord('person', '1');
* const person = store.peekRecord('person', '1');
* person.name = 'Chris';
* const options = updateRecord(person, { patch: true });
* const data = await store.request(options);
Expand Down

0 comments on commit 72b1e21

Please sign in to comment.