17 lines
389 B
TypeScript
17 lines
389 B
TypeScript
interface BoardValidationInput {
|
|
attempted: boolean;
|
|
hasExistingBoards: boolean;
|
|
selectedBoardId: string | null;
|
|
boardName: string;
|
|
}
|
|
|
|
export const getBoardValidationErrors = ({
|
|
attempted,
|
|
hasExistingBoards,
|
|
selectedBoardId,
|
|
boardName,
|
|
}: BoardValidationInput) => ({
|
|
target: attempted && hasExistingBoards && !selectedBoardId,
|
|
name: attempted && !boardName.trim(),
|
|
});
|