'use client'; import { createContext, useContext } from 'react'; import type { Dispatch, SetStateAction } from 'react'; import type { GoalConfigItem } from '@/types/response/donation/goalConfig'; export type GoalConfigContextValue = { items: GoalConfigItem[]; loading: boolean; saving: boolean; setSaving: Dispatch>; fetchList: () => void; }; export const GoalConfigContext = createContext(null); export function useGoalConfigContext(): GoalConfigContextValue { const ctx = useContext(GoalConfigContext); if (!ctx) { throw new Error('useGoalConfigContext must be used within GoalConfigProvider'); } return ctx; }