Skip to content

Refactor: Centralize localStorage Operations in a Storage Utility #194

Description

@zaibamachhaliya

Problem

AppContext.jsx currently contains direct localStorage operations for:

  • PAT (oe_pat)
  • Rate limit (oe_rate_limit)
  • Recent searches (oe_recent)

This couples storage logic with application state and makes it harder to maintain.

Proposed Solution

Create a reusable storage utility at:

src/utils/storage.js

The utility should:

  • Centralize localStorage access
  • Define storage keys using STORAGE_KEYS
  • Provide get, set, and remove methods

Then update src/context/AppContext.jsx to use the storage utility instead of accessing localStorage directly.

Expected Result

  • No direct localStorage calls in AppContext.jsx
  • Storage keys have a single source of truth
  • Existing PAT, rate-limit, and recent-search behaviour remains unchanged

Type: Code Quality Improvement

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions