You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This command creates several new files and updates `app.modules.ts`file to import the `NgxsModule` with the new state.
883
+
* This command creates `books.state.ts`and `books.actions.ts`files in the `src/app/books/state` folder. See the [NGXS CLI documentation](https://www.ngxs.io/plugins/cli).
884
884
885
-
#### Get books data from backend
886
-
887
-
Create data types to map the data from the backend (you can check Swagger UI or your backend API to see the data format).
Open the `books.ts` file in the `app\store\models` folder and replace the content as below:
885
+
Import the `BooksState` to the `app.module.ts` in the `src/app` folder and then add the `BooksState` to `forRoot` static method of `NgxsModule` as an array element of the first parameter of the method.
* Added `Book` interface that represents a book object and `BookType` enum which represents a book category.
904
+
#### Generate proxies
931
905
932
-
#### BooksService
906
+
ABP CLI provides `generate-proxy` command that generates client proxies for your HTTP APIs to make easy to consume your services from the client side. Before running generate-proxy command, your host must be up and running. See the [CLI documentation](../CLI.md)
933
907
934
-
Create a new service, named `BooksService` to perform `HTTP` calls to the server:
908
+
Run the following command in the `angular` folder:
* We added the `get` method to get the list of books by performing an HTTP request to the related endpoint.
922
+
Actions can either be thought of as a command which should trigger something to happen, or as the resulting event of something that has already happened. [See NGXS Actions documentation](https://www.ngxs.io/concepts/actions).
966
923
967
-
Open the`books.actions.ts` file in `app\store\actions` folder and replace the content below:
924
+
Open the`books.actions.ts` file in `app/books/state` folder and replace the content below:
968
925
969
926
```js
970
927
exportclassGetBooks {
@@ -974,43 +931,48 @@ export class GetBooks {
974
931
975
932
#### Implement BooksState
976
933
977
-
Open the `books.state.ts` file in `app\store\states` folder and replace the content below:
934
+
Open the `books.state.ts` file in `app/books/state` folder and replace the content below:
0 commit comments