chore: clean up type errors and warnings
This commit is contained in:
@@ -13,15 +13,20 @@ export function DeleteListConfirmation({
|
||||
const { boardData } = useBoard();
|
||||
const { closeModal } = useModal();
|
||||
|
||||
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 deleteList = api.list.delete.useMutation({
|
||||
onSuccess: async () => {
|
||||
onSuccess: () => {
|
||||
closeModal();
|
||||
await refetchBoard();
|
||||
return refetchBoard();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import CheckboxDropdown from "~/components/CheckboxDropdown";
|
||||
import { useBoard } from "~/providers/board";
|
||||
import { useModal } from "~/providers/modal";
|
||||
|
||||
import { NewCardInput } from "~/types/router.types";
|
||||
import { type NewCardInput } from "~/types/router.types";
|
||||
|
||||
type NewCardFormInput = NewCardInput & {
|
||||
isCreateAnotherEnabled: boolean;
|
||||
@@ -43,9 +43,14 @@ export function NewCardForm({ listPublicId }: NewCardFormProps) {
|
||||
const memberPublicIds = watch("memberPublicIds") || [];
|
||||
const isCreateAnotherEnabled = watch("isCreateAnotherEnabled");
|
||||
|
||||
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 createCard = api.card.create.useMutation({
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Switch } from "@headlessui/react";
|
||||
import { useBoard } from "~/providers/board";
|
||||
import { useModal } from "~/providers/modal";
|
||||
|
||||
import { NewListInput } from "~/types/router.types";
|
||||
import { type NewListInput } from "~/types/router.types";
|
||||
|
||||
import { Formik, Form, Field } from "formik";
|
||||
|
||||
@@ -21,16 +21,21 @@ export function NewListForm({ boardPublicId }: { boardPublicId: string }) {
|
||||
const { closeModal } = useModal();
|
||||
const [isCreateAnotherEnabled, setIsCreateAnotherEnabled] = useState(false);
|
||||
|
||||
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 createList = api.list.create.useMutation({
|
||||
onSuccess: async () => {
|
||||
onSuccess: () => {
|
||||
try {
|
||||
await refetchBoard();
|
||||
if (!isCreateAnotherEnabled) closeModal();
|
||||
return refetchBoard();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import { NewWorkspaceForm } from "~/components/NewWorkspaceForm";
|
||||
import { NewCardForm } from "./components/NewCardForm";
|
||||
import { NewListForm } from "./components/NewListForm";
|
||||
|
||||
import { UpdateBoardInput } from "~/types/router.types";
|
||||
import { type UpdateBoardInput } from "~/types/router.types";
|
||||
|
||||
type PublicListId = string;
|
||||
|
||||
@@ -228,7 +228,7 @@ export default function BoardPage() {
|
||||
>
|
||||
<svg
|
||||
fill={
|
||||
label.colourCode || undefined
|
||||
label.colourCode ?? undefined
|
||||
}
|
||||
className="h-2 w-2"
|
||||
viewBox="0 0 6 6"
|
||||
@@ -246,15 +246,14 @@ export default function BoardPage() {
|
||||
className="inline-flex h-6 w-6 items-center justify-center rounded-full bg-light-900 ring-2 ring-light-50 dark:bg-gray-500 dark:ring-dark-500"
|
||||
>
|
||||
<span className="text-[10px] font-medium leading-none text-white">
|
||||
{member?.user?.name &&
|
||||
member.user.name
|
||||
.split(" ")
|
||||
.map((namePart) =>
|
||||
namePart
|
||||
.charAt(0)
|
||||
.toUpperCase(),
|
||||
)
|
||||
.join("")}
|
||||
{member?.user?.name
|
||||
?.split(" ")
|
||||
.map((namePart) =>
|
||||
namePart
|
||||
.charAt(0)
|
||||
.toUpperCase(),
|
||||
)
|
||||
.join("")}
|
||||
</span>
|
||||
</span>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user