refactor: consolidate message display options into a shared MessageOptions interface.

This commit is contained in:
2025-12-02 13:10:25 +01:00
parent ebe8b163b9
commit cf41148942
4 changed files with 10 additions and 8 deletions
@@ -14,7 +14,7 @@ import {
updateDocument,
} from '../../lib/apiClient';
import type { DocumentId, FolderId as FolderIdentifier } from '../../types/identifiers';
import type { Document } from '../../types/documents';
import type { Document, MessageOptions } from '../../types/documents';
type FolderId = FolderIdentifier | 'root';
type NullableFolderId = FolderId | null;
@@ -78,10 +78,6 @@ interface DocumentTagExtras {
input?: { value?: string } | null;
}
interface MessageOptions {
showMessage?: boolean;
}
interface UseDocumentMutationsArgs {
token?: string | null;
documentLookup: Map<DocumentId, Document>;
@@ -8,6 +8,7 @@ import {
renameFolder as renameFolderRequest,
} from '../../lib/apiClient';
import type { FolderId } from '../../types/identifiers';
import type { MessageOptions } from '../../types/documents';
type FolderKey = FolderId | 'root';
@@ -409,7 +410,7 @@ const useFolderTreeActions = ({
);
const handleFolderDelete = useCallback(
async (folderId: FolderKey, { showMessage = true }: { showMessage?: boolean } = {}) => {
async (folderId: FolderKey, { showMessage = true }: MessageOptions = {}) => {
if (!token) {
if (showMessage) {
setStatusMessage('Log in to manage folders.', 'error');