File size: 1,687 Bytes
6d643ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | // HTTP Status Codes
export const HTTP_STATUS = {
OK: 200,
CREATED: 201,
NO_CONTENT: 204,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
FORBIDDEN: 403,
NOT_FOUND: 404,
CONFLICT: 409,
UNPROCESSABLE_ENTITY: 422,
RATE_LIMITED: 429,
INTERNAL_SERVER_ERROR: 500,
BAD_GATEWAY: 502,
SERVICE_UNAVAILABLE: 503,
} as const;
// Error Codes
export const ERROR_CODES = {
NETWORK_ERROR: 'NETWORK_ERROR',
VALIDATION_ERROR: 'VALIDATION_ERROR',
UNAUTHORIZED: 'UNAUTHORIZED',
FORBIDDEN: 'FORBIDDEN',
NOT_FOUND: 'NOT_FOUND',
RATE_LIMIT: 'RATE_LIMIT',
API_ERROR: 'API_ERROR',
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
} as const;
// Local Storage Keys
export const STORAGE_KEYS = {
AUTH_TOKEN: 'auth_token',
USER_PREFERENCES: 'user_preferences',
THEME: 'theme',
} as const;
// Query Key Prefixes
export const QUERY_KEYS = {
CLOSET: 'closet',
PRODUCTS: 'products',
SCRAPE: 'scrape',
} as const;
// Default Values
export const DEFAULTS = {
PAGE_SIZE: 20,
SEARCH_DEBOUNCE: 300,
TOAST_DURATION: 4000,
} as const;
// File Upload Constraints
export const FILE_CONSTRAINTS = {
MAX_FILES: 1,
ACCEPTED_FORMATS: ['image/jpeg', 'image/png', 'image/webp', 'image/heic'],
MAX_SIZE_MB: 25,
} as const;
// Validation Limits
export const VALIDATION_LIMITS = {
NAME_MAX_LENGTH: 100,
BRAND_MAX_LENGTH: 50,
SEARCH_QUERY_MAX_LENGTH: 200,
MAX_PAGINATION_LIMIT: 100,
} as const;
export type HttpStatus = (typeof HTTP_STATUS)[keyof typeof HTTP_STATUS];
export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
export type StorageKey = (typeof STORAGE_KEYS)[keyof typeof STORAGE_KEYS];
export type QueryKey = (typeof QUERY_KEYS)[keyof typeof QUERY_KEYS];
|