chore: clean up type errors and warnings

This commit is contained in:
Henry
2024-07-24 16:05:40 +01:00
parent bfd23406dd
commit d334607a9c
11 changed files with 178 additions and 50 deletions

View File

@@ -8,9 +8,9 @@ import React, {
import { api } from "~/utils/api";
import {
GetBoardByIdOutput,
ReorderCardInput,
ReorderListInput,
type GetBoardByIdOutput,
type ReorderCardInput,
type ReorderListInput,
} from "~/types/router.types";
interface BoardContextProps {
@@ -40,29 +40,22 @@ export const BoardProvider: React.FC<{ children: ReactNode }> = ({
const [boardData, setBoardData] =
useState<GetBoardByIdOutput>(initialBoardData);
const refetchBoard = () => {
if (boardData?.publicId)
utils.board.byId.refetch({ boardPublicId: boardData.publicId });
const refetchBoard = async () => {
if (boardData?.publicId) {
try {
await utils.board.byId.refetch({ boardPublicId: boardData.publicId });
} catch (e) {
console.error(e);
}
}
};
const updateCardMutation = api.card.reorder.useMutation({
onSuccess: async () => {
try {
await refetchBoard();
} catch (e) {
console.log(e);
}
},
onSuccess: () => refetchBoard(),
});
const updateListMutation = api.list.reorder.useMutation({
onSuccess: async () => {
try {
await refetchBoard();
} catch (e) {
console.log(e);
}
},
onSuccess: () => refetchBoard(),
});
const updateList = ({