Using Elf in NX mono repo as separate lib - proper way to interact with state from workspace apps #36
-
Hello, I have a nx workspace with 2 angular apps and a nativescript app that use firebase for the "backend" auth and storage. My goal is to have a stand alone lib that manages state that can be consumed by the 3 different libs. So I created an angular lib and created an auth store for tracking user credentials/details in the façade pattern:
now I have a separate file for managing the effects. This is where I need help thinking through how to set it up. I have an effect that logs the user in with firestore auth and returns a user object. I want my state to track the user details.
My question is who calls this effect? Do I call it from the angular app component, or should I dispatch an action that triggers this effect? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Inject the AuthEffects and call loginUser. |
Beta Was this translation helpful? Give feedback.
-
thanks for the follow up Netanel, reading those docs helped. I think for my project structure it make more sense to use actions and then have effects triggered that way. |
Beta Was this translation helpful? Give feedback.
Inject the AuthEffects and call loginUser.
https://github.com/ngneat/effects#use-with-angular-1