reactjs - Redux use token in every API request -


i trying develop app using react native, redux , redux saga.

i have following login flow:

  1. login form
  2. login attempt action
  3. login saga
  4. api call
  5. 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

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -