|
1 | 1 | # Incremental adoption guide for existing projects
|
2 | 2 |
|
3 |
| -Nav links |
| 3 | +- ⮐ [Cookbook](./index.md) |
4 | 4 |
|
5 |
| ---- |
6 |
| - |
7 |
| -This guide is for existing projects that want to adopt the new APIs of the EmberData incrementally. If you are starting a new project, you should use the [new project guide](./new-project-guide.md). |
| 5 | +This guide is for existing projects that want to adopt the new APIs of the EmberData incrementally. |
8 | 6 |
|
9 | 7 | ## Step 1: Upgrade to EmberData 4.12.x
|
10 | 8 |
|
@@ -48,11 +46,11 @@ import Fetch from '@ember-data/request/fetch';
|
48 | 46 |
|
49 | 47 | /* eslint-disable no-console */
|
50 | 48 | const TestHandler: Handler = {
|
51 |
| - async request<T>(context: RequestContext, next: NextFn) { |
| 49 | + async request<T>(context: RequestContext, next: NextFn<T>) { |
52 | 50 | console.log('TestHandler.request', context.request);
|
53 |
| - const newContext = await next(Object.assign({}, context.request)); |
54 |
| - console.log('TestHandler.response after fetch', newContext.response); |
55 |
| - return newContext as T; |
| 51 | + const result = await next(Object.assign({}, context.request)); |
| 52 | + console.log('TestHandler.response after fetch', result.response); |
| 53 | + return result; |
56 | 54 | },
|
57 | 55 | };
|
58 | 56 |
|
@@ -144,3 +142,7 @@ export default class App extends Application {
|
144 | 142 |
|
145 | 143 | loadInitializers(App, config.modulePrefix);
|
146 | 144 | ```
|
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +- ⮐ [Cookbook](./index.md) |
0 commit comments