fixing update delete reward

This commit is contained in:
Raja Oktafrianto
2025-04-09 09:56:26 +07:00
parent 0c5608273f
commit 0a1ff7de18
6 changed files with 81 additions and 76 deletions

View File

@ -26,10 +26,10 @@ interface ContextProps {
showAddDialog: boolean;
handleAddDialog: (show: boolean) => void;
showEditDialog: boolean;
handleEditDialog: (show: boolean, selected_reward: string | null) => void;
handleEditDialog: (show: boolean, selected_reward: Reward | null) => void;
showDeleteDialog: boolean;
handleDeleteDialog: (show: boolean, selected_rewad: string | null) => void;
selectedReward: string | null;
handleDeleteDialog: (show: boolean, selected_rewad: Reward | null) => void;
selectedReward: Reward | null;
reward: string | null;
}
@ -52,19 +52,19 @@ const ManageRewardContextProvider = ({ children }: { children: React.ReactNode }
const [showAddDialog, setShowAddDialog] = useState(false);
const [showEditDialog, setShowEditDialog] = useState(false);
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
const [selectedReward, setSelectedReward] = useState<string | null>(null);
const [selectedReward, setSelectedReward] = useState<Reward | null>(null);
const { GetData } = useCallApi();
const handleAddDialog = useCallback((show: boolean) => {
setShowAddDialog(show);
}, []);
const handleEditDialog = useCallback((show: boolean, selected_reward: string | null) => {
const handleEditDialog = useCallback((show: boolean, selected_reward: Reward | null) => {
setShowEditDialog(show);
setSelectedReward(show ? selected_reward : null);
}, []);
const handleDeleteDialog = useCallback((show: boolean, selected_reward: string | null) => {
const handleDeleteDialog = useCallback((show: boolean, selected_reward: Reward | null) => {
setShowDeleteDialog(show);
setSelectedReward(show ? selected_reward : null);
}, []);