mirror of
https://github.com/documenso/documenso.git
synced 2025-11-16 01:32:06 +10:00
feat: add/update title of the document (#663)
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
'use server';
|
||||
|
||||
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session';
|
||||
import { updateTitle } from '@documenso/lib/server-only/document/update-title';
|
||||
import type { TAddTitleFormSchema } from '@documenso/ui/primitives/document-flow/add-title.types';
|
||||
|
||||
export type AddTitleActionInput = TAddTitleFormSchema & {
|
||||
documentId: number;
|
||||
};
|
||||
|
||||
export const addTitle = async ({ documentId, title }: AddTitleActionInput) => {
|
||||
'use server';
|
||||
|
||||
const { user } = await getRequiredServerComponentSession();
|
||||
|
||||
await updateTitle({
|
||||
documentId,
|
||||
userId: user.id,
|
||||
title: title,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user