refactor: return types for hooks
This commit is contained in:
@ -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({
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useMediaQuery } from "@mantine/hooks";
|
||||
|
||||
const useIsMobile = () => {
|
||||
const useIsMobile = (): boolean => {
|
||||
return useMediaQuery("(max-width: 48em)");
|
||||
};
|
||||
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -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({
|
||||
|
||||
Reference in New Issue
Block a user