( slug: string, title: string )
| 114 | } |
| 115 | |
| 116 | export async function updateDocument( |
| 117 | slug: string, |
| 118 | title: string |
| 119 | ): Promise<JSONDocument | undefined> { |
| 120 | const document = await getDocument(slug); |
| 121 | |
| 122 | if (!document) return; |
| 123 | |
| 124 | const updated = { ...document, title }; |
| 125 | |
| 126 | await DOCUMENTS.put(slug, JSON.stringify(updated)); |
| 127 | |
| 128 | return updated; |
| 129 | } |
| 130 | |
| 131 | export async function deleteDocument(slug: string): Promise<void> { |
| 132 | await DOCUMENTS.delete(slug); |