reactjs - Redux use token in every API request -
i trying develop app using react native, redux , redux saga.
i have following login flow:
- login form
- login attempt action
- login saga
- api call
- login reducer stores auth token
i have multiple containers , components each execute actions in turn have sagas doing api calls. correct way pass token store api calling method while keeping code clean , reusable.
you can create api saga(s) process api actions other app sagas. use select
effect here token store , pass api call
. keep api call
separated saga more abstraction , dry principle. there several options call saga: direct yield*
or throwing redux action.
Comments
Post a Comment