refactor: return types for hooks

This commit is contained in:
2025-08-14 16:15:10 +04:00
parent c3b0da1e0d
commit 28004dc2a0
7 changed files with 57 additions and 11 deletions

View File

@ -24,12 +24,18 @@ type UseBoardsOperationsProps = {
projectId?: number;
};
type BoardsOperations = {
onCreateBoard: (name: string) => void;
onUpdateBoard: (boardId: number, board: UpdateBoardSchema) => void;
onDeleteBoard: (board: BoardSchema) => void;
};
export const useBoardsOperations = ({
boards,
setBoards,
refetchBoards,
projectId,
}: UseBoardsOperationsProps) => {
}: UseBoardsOperationsProps): BoardsOperations => {
const onError = (error: AxiosError<HttpValidationError>) => {
console.error(error);
notifications.error({

View File

@ -1,6 +1,6 @@
import { useMediaQuery } from "@mantine/hooks";
const useIsMobile = () => {
const useIsMobile = (): boolean => {
return useMediaQuery("(max-width: 48em)");
};

View File

@ -21,11 +21,17 @@ type Props = {
refetchProjects: () => void;
};
type ProjectsOperations = {
onCreateProject: (name: string) => void;
onUpdateProject: (projectId: number, project: UpdateProjectSchema) => void;
onDeleteProject: (project: ProjectSchema) => void;
};
export const useProjectsOperations = ({
projects,
setProjects,
refetchProjects,
}: Props) => {
}: Props): ProjectsOperations => {
const onError = (error: AxiosError<HttpValidationError>) => {
console.error(error);
notifications.error({

View File

@ -24,12 +24,18 @@ type Props = {
boardId?: number;
};
type StatusesOperations = {
onCreateStatus: (name: string) => void;
onUpdateStatus: (statusId: number, status: UpdateStatusSchema) => void;
onDeleteStatus: (status: StatusSchema) => void;
};
export const useStatusesOperations = ({
statuses,
setStatuses,
refetchStatuses,
boardId,
}: Props) => {
}: Props): StatusesOperations => {
const onError = (error: AxiosError<HttpValidationError>) => {
console.error(error);
notifications.error({