Skip to content

Abstract localStorage interactions into a custom Hook#135

Open
Agnish1611 wants to merge 1 commit into
pieces-app:mainfrom
Agnish1611:issue-125-abstract-localStorage-usage
Open

Abstract localStorage interactions into a custom Hook#135
Agnish1611 wants to merge 1 commit into
pieces-app:mainfrom
Agnish1611:issue-125-abstract-localStorage-usage

Conversation

@Agnish1611

@Agnish1611 Agnish1611 commented Jul 17, 2024

Copy link
Copy Markdown

Description
This PR creates a custom Hook called useOsVersion to abstract the localStorage interactions. The logic for accessing and updating the OS version has been encapsulated into this hook #125

Changes

  • Created a new file src/app/components/Indicator/useOsVersion.tsx which exports the custom useOsVersion hook with three states:
    • osVersion: variable which stores the version from the localStorage
    • updateOsVersion: function which updates the OS version in the localStorage
    • error: variable which stores the error message in case some error occured while accessing or updating the OS version
  • The error handling specifically handles the quota exceeded error using the isQuotaExceededError function

@Arindam200

Copy link
Copy Markdown
Contributor

Hey @Agnish1611 , this issue is already being worked on #130 ,

However, I would recommend that you collaborate there and probably review that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants