This change actually makes the authoring flow work for the most part by tying in emailing and more. We have also done a number of quality of life updates to simplify the codebase overall making it easier to continue work on the refresh.
22 lines
586 B
TypeScript
22 lines
586 B
TypeScript
'use server';
|
|
|
|
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-session';
|
|
import { sendDocument } from '@documenso/lib/server-only/document/send-document';
|
|
|
|
import { TAddSubjectFormSchema } from './add-subject.types';
|
|
|
|
export type CompleteDocumentActionInput = TAddSubjectFormSchema & {
|
|
documentId: number;
|
|
};
|
|
|
|
export const completeDocument = async ({ documentId }: CompleteDocumentActionInput) => {
|
|
'use server';
|
|
|
|
const { id: userId } = await getRequiredServerComponentSession();
|
|
|
|
await sendDocument({
|
|
userId,
|
|
documentId,
|
|
});
|
|
};
|