refactor: extract magic constants — wave 1 (UX, API, storage)
- Use existing MULTIPLIER_S/M/L from \$entities/Font in SliderArea instead of inlining the 0.5/0.75/1 literals (constants already existed but were duplicated at the call site). - Centralize API base URL in \$shared/api/endpoints.ts (was duplicated between proxyFonts and FilterAndSortFonts filters api). - Promote every 'glyphdiff:...' localStorage key to a named module-level STORAGE_KEY constant. Test files now import the source constant rather than redeclaring it (eliminates silent-typo divergence risk).
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Centralized backend endpoint definitions.
|
||||
*
|
||||
* One source of truth for the proxy API base URL — individual resource
|
||||
* modules (proxyFonts, filters) append their own paths.
|
||||
*/
|
||||
|
||||
export const API_BASE_URL = 'https://api.glyphdiff.com/api/v1' as const;
|
||||
|
||||
export const API_ENDPOINTS = {
|
||||
/**
|
||||
* Font catalog + per-id detail + batch lookup
|
||||
*/
|
||||
fonts: `${API_BASE_URL}/fonts`,
|
||||
/**
|
||||
* Filter metadata (providers, categories, subsets)
|
||||
*/
|
||||
filters: `${API_BASE_URL}/filters`,
|
||||
} as const;
|
||||
Reference in New Issue
Block a user