Created
June 13, 2022 01:24
-
-
Save thecodinganalyst/7ae5003844c2f51f1a31d16bf95f2e21 to your computer and use it in GitHub Desktop.
NgRx Action Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createAction, props} from "@ngrx/store"; | |
import {Book} from "../book"; | |
const loadBooks = createAction("[BookList] Load Books"); | |
const booksLoaded = createAction("[BookList] Books Loaded", props<{ books: ReadonlyArray<Book> }>()) | |
const showBook = createAction("[BookList] Show Book", props<{book: Book}>()); | |
const newBook = createAction("[BookList] New Book"); | |
const saveBook = createAction("[BookList] Save Book", props<{ book: Book}>()); | |
const bookSaved = createAction("[BookList] Book Saved", props<{book: Book}>()); | |
const deleteBook = createAction("[BookList] Delete Book", props<{id: number}>()); | |
const bookDeleted = createAction("[BookList] Book Deleted", props<{ book: Book }>()); | |
const dismissPopup = createAction("[App] Dismiss Popup"); | |
export const BookStoreActions = { | |
loadBooks, booksLoaded, showBook, newBook, saveBook, bookSaved, deleteBook, bookDeleted, dismissPopup | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment