19 lines
500 B
TypeScript
19 lines
500 B
TypeScript
import { useCardPageContext } from "../../../contexts/CardPageContext.tsx";
|
|
import { CardService } from "../../../../../client";
|
|
|
|
const useUpdateCard = () => {
|
|
const { selectedCard, setSelectedCard } = useCardPageContext();
|
|
|
|
const update = () => {
|
|
if (!selectedCard) return;
|
|
CardService.getCardById({ cardId: selectedCard.id })
|
|
.then(data => {
|
|
setSelectedCard(data);
|
|
});
|
|
};
|
|
|
|
return { update };
|
|
};
|
|
|
|
export default useUpdateCard;
|