diff --git a/__tests__/hooks/useNotifications.test.ts b/__tests__/hooks/useNotifications.test.ts index 1c4d217..1d31da7 100644 --- a/__tests__/hooks/useNotifications.test.ts +++ b/__tests__/hooks/useNotifications.test.ts @@ -178,7 +178,7 @@ describe("useNotifications", () => { expect(result.current.isLoading).toBe(false); }); - let prefs: Record | null; + let prefs: Awaited>; await act(async () => { prefs = await result.current.getPreferences(); }); diff --git a/__tests__/hooks/useWorkflowState.test.ts b/__tests__/hooks/useWorkflowState.test.ts index ea9e2cf..33dbbe1 100644 --- a/__tests__/hooks/useWorkflowState.test.ts +++ b/__tests__/hooks/useWorkflowState.test.ts @@ -172,7 +172,7 @@ describe("useWorkflowState", () => { expect(mockReject).toHaveBeenCalledWith({ object: "tasks", recordId: "rec-1", - comment: "Needs changes", + reason: "Needs changes", }); }); }); diff --git a/hooks/useNotifications.ts b/hooks/useNotifications.ts index bfcddae..692fbbd 100644 --- a/hooks/useNotifications.ts +++ b/hooks/useNotifications.ts @@ -3,9 +3,11 @@ import { useClient } from "@objectstack/client-react"; import type { ListNotificationsResponse, RegisterDeviceResponse, +} from "@objectstack/client"; +import type { GetNotificationPreferencesResponse, UpdateNotificationPreferencesResponse, -} from "@objectstack/client"; +} from "@objectstack/spec/api"; /* ------------------------------------------------------------------ */ /* Types */ diff --git a/hooks/useWorkflowState.ts b/hooks/useWorkflowState.ts index a722199..d332005 100644 --- a/hooks/useWorkflowState.ts +++ b/hooks/useWorkflowState.ts @@ -48,7 +48,7 @@ export interface UseWorkflowStateResult { /** Approve a workflow step */ approve: (comment?: string) => Promise; /** Reject a workflow step */ - reject: (comment?: string) => Promise; + reject: (reason: string, comment?: string) => Promise; /** Refetch the workflow state */ refetch: () => Promise; } @@ -121,10 +121,11 @@ export function useWorkflowState( ); const doReject = useCallback( - async (comment?: string): Promise => { + async (reason: string, comment?: string): Promise => { const result = await client.workflow.reject({ object: objectName, recordId, + reason, comment, }); await fetchState();