gabrielguerrero / ngrx-traits

NGRX Traits is a library to help you compose and reuse state logic in your angular app. There is two versions, @ngrx-traits/signals supports ngrx-signals, and @ngrx-traits/{core, common} supports ngrx.
MIT License
50 stars 3 forks source link

storeEntity trait #2

Closed gabrielguerrero closed 2 years ago

gabrielguerrero commented 3 years ago

The goal of this trait is to create actions that store a value in a property of the store, and a selector to read it, something like

addStoreEntity({
        entityName: 'client',
        actionProps: props<{ id: string , name: string}>(),
      })

and that will generate actions.storeClient({client: {id: '123', name: 'Gabs'}}) selectors.selectClient()

It will not need success and fail because its local stored, also the name could be addSetEntity with the action like set* instead of store