EmbeddedChat
EmbeddedChat copied to clipboard
fix/#132(task-9) - Refactor-useEffects
Refactored useEffects in src/index.js
Acceptance Criteria fulfillment
- [X] Task 9 - Refactor useEffects
Fixes #132
Description
In this refactoring:
-
The first
useEffectblock is kept as is since it doesn't require changes. -
The second
useEffectblock is refactored to create a separate functionhandleLogoutAndReInstantiateto handle the logic of logging out and reinstantiating theRCInstance. This function is called conditionally based on the user's login status. -
The third
useEffectblock is refactored to extract the logic into a function namedhandleAuthChange, which is called when the authentication status changes.