Refactor hooks and contexts for improved state management and modularity
Some checks are pending
Deploy to Test Environment / deploy-to-test (push) Has started running

- Updated `useActiveDeals` hook to include reset functionality for API calls.
- Enhanced `useApi` hook to provide a reset method for clearing state.
- Refactored `useAuth`, `useFlyers`, `useMasterItems`, `useModal`, and `useUserData` hooks to utilize context providers for better state management.
- Created new context files: `AuthContext`, `FlyersContext`, `MasterItemsContext`, `ModalContext`, and `UserDataContext` to encapsulate related state and logic.
- Updated tests for hooks to accommodate changes in context structure and reset functionality.
- Adjusted imports in `index.tsx` to reflect new context structure.
This commit is contained in:
2025-12-14 20:08:15 -08:00
parent d3e546d02f
commit 8274f4c871
21 changed files with 397 additions and 345 deletions

View File

@@ -1,7 +1,8 @@
import React, { ReactNode } from 'react';
import { renderHook, waitFor, act } from '@testing-library/react';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { AuthProvider, useAuth } from './useAuth';
import { useAuth } from './useAuth';
import { AuthProvider } from '../contexts/AuthContext';
import * as apiClient from '../services/apiClient';
import type { User, UserProfile } from '../types';