This repository was archived by the owner on Jun 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +8
-62
lines changed Expand file tree Collapse file tree 6 files changed +8
-62
lines changed Original file line number Diff line number Diff line change 3030 - run :
3131 name : Compiling Code
3232 command : npm run build
33- - run :
34- name : Running tests
35- command : npm run cover
3633 - run :
3734 name : Linting Code
3835 command : npm run lint
Original file line number Diff line number Diff line change 551 . Install it with ` npm i @js-entity-repos/axios ` .
661 . For each entity you will need to do the following.
77 1 . [ Create an Entity interface] ( #entity-interface ) .
8- 1 . [ Create a factory config] ( #factory-config ) .
98 1 . [ Construct the facade] ( #construct-the-facade ) .
109 1 . [ Use the facade] ( https://github.com/js-entity-repos/core/blob/master/docs/facade.md ) .
1110
@@ -22,13 +21,13 @@ export interface TodoEntity extends Entity {
2221}
2322```
2423
25- ### Factory Config
24+ ### Construct the Facade
2625
2726``` ts
28- import FactoryConfig from ' @js-entity-repos/axios/dist/FactoryConfig ' ;
27+ import factory from ' @js-entity-repos/axios/dist/factory ' ;
2928import axios from ' axios' ;
3029
31- const todoFactoryConfig : FactoryConfig <TodoEntity > = {
30+ const todosFacade = factory <TodoEntity >( {
3231 axios: axios .create ({
3332 baseURL: ` http://localhost:80/api/todos ` ,
3433 }),
@@ -50,13 +49,5 @@ const todoFactoryConfig: FactoryConfig<TodoEntity> = {
5049 },
5150 defaultPaginationLimit: 100 , // Optional property.
5251 entityName: ' todo' ,
53- };
54- ```
55-
56- ### Construct the Facade
57-
58- ``` ts
59- import factory from ' @js-entity-repos/axios/dist/factory' ;
60-
61- const todosFacade = factory (todoFactoryConfig );
52+ });
6253```
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ sourceMapSupport.install();
33
44import facadeTest from '@js-entity-repos/core/dist/tests' ;
55import { TestEntity } from '@js-entity-repos/core/dist/tests/utils/testEntity' ;
6+ import createTestServer from '@js-entity-repos/express/dist/utils/createTestServer' ;
67import axios from 'axios' ;
78import { config } from 'dotenv' ;
89import 'mocha' ; // tslint:disable-line:no-import-side-effect
910import factory from './factory' ;
10- import createTestServer from './utils/createTestServer' ;
1111config ( ) ;
1212
1313const defaultServerPort = 1337 ;
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ export default <E extends Entity>(config: FacadeConfig<E>): GetEntities<E> => {
2222 } ;
2323 const response = await Promise . resolve ( config . axios . get ( '' , { params } ) ) ;
2424
25- const entities = response . data . entities . map ( config . constructEntity ) ;
26- const nextCursor = response . data . nextCursor ;
27- const previousCursor = response . data . previousCursor ;
25+ const entities = response . data . map ( config . constructEntity ) ;
26+ const nextCursor = response . headers [ 'x-entities-next-cursor' ] ;
27+ const previousCursor = response . headers [ 'x-entities-previous-cursor' ] ;
2828
2929 return { entities, nextCursor, previousCursor } ;
3030 } ;
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments