Closed amnambiar closed 1 year ago
This pull request simplifies state initialization using the useLocalStorage
hook across multiple components, enhancing readability and reducing complexity. It also introduces robust error handling mechanisms, including a new utility function getErrorMessage
, to improve user experience during unexpected scenarios.
File(s) | Summary |
---|---|
src/components/ConnectWallet/ConnectWallet.tsx ,src/components/Header/Header.tsx ,src/pages/home/Home.tsx ,src/pages/userProfile/UserProfile.tsx |
Simplified state initialization using useLocalStorage hook, improving code readability and maintainability. |
src/hooks/useLocalStorage.ts ,src/hooks/useLogs.ts |
Enhanced useLocalStorage hook to handle different types of values and prevent storing empty or null values. Removed unnecessary code in useLogs . |
src/pages/certification/Certification.tsx ,src/pages/subscription/payment/Payment.tsx |
Introduced robust error handling with getErrorMessage utility function. Improved user experience during unexpected scenarios. |
src/components/PrivateRoutes/PrivateRoutes.tsx |
Added checks to ensure user is logged in before accessing private routes, enhancing security. |
src/utils/utils.ts |
Added getErrorMessage function to generate appropriate error messages based on error object properties. |
"In the land of code, where logic is king, ๐คด๐
A rabbit hopped by, making changes with a swing. ๐๐ป
State simplified, errors handled with care, ๐ฏ๐ ๏ธ
Making the codebase cleaner, lighter, and fair. ๐งนโจ"
https://input-output.atlassian.net/browse/PLT-7439
Across BE
master
Summary by CodeRabbit
Refactor:
ConnectWallet
,Header
,PrivateRoutes
,Home
,UserProfile
) using theuseLocalStorage
hook, improving code readability and maintainability.Header
,Certification
, andPayment
components by utilizing a new utility functiongetErrorMessage
.New Feature:
getErrorMessage
to generate user-friendly error messages based on different types of error objects.Bug Fix:
onRequestError
to clear local storage and reload the window if the user is not logged in.Chore: