AOSSIE-Org / AOSSIE-Org/OrgExplorer

Refactor: Centralize localStorage Operations in a Storage Utility

Đang mở
#194 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
JavaScript
Star
34
Fork
92
Merge trung bình
8 ngày 7 giờ
Pull request đã merge (30 ngày)
12

Mô tả

## 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reading src/context/AppContext.jsx to locate the PAT, rate-limit, and recent-search localStorage operations, then inspect the surrounding src/utils structure. Use the issue's expected results as the checklist: storage access and keys are centralized in src/utils/storage.js, AppContext.jsx has no direct localStorage calls, and existing behavior remains unchanged.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
frontend
Loại issue
Tái cấu trúc
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
76/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.