File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -77,19 +77,22 @@ export async function POST(request: Request) {
77
77
return Response . json ( document , { status : 200 } ) ;
78
78
}
79
79
80
- export async function PATCH ( request : Request ) {
80
+ export async function DELETE ( request : Request ) {
81
81
const { searchParams } = new URL ( request . url ) ;
82
82
const id = searchParams . get ( 'id' ) ;
83
-
84
- const { timestamp } : { timestamp : string } = await request . json ( ) ;
83
+ const timestamp = searchParams . get ( 'timestamp' ) ;
85
84
86
85
if ( ! id ) {
87
86
return new Response ( 'Missing id' , { status : 400 } ) ;
88
87
}
89
88
89
+ if ( ! timestamp ) {
90
+ return new Response ( 'Missing timestamp' , { status : 400 } ) ;
91
+ }
92
+
90
93
const session = await auth ( ) ;
91
94
92
- if ( ! session || ! session . user ) {
95
+ if ( ! session ? .user ?. id ) {
93
96
return new Response ( 'Unauthorized' , { status : 401 } ) ;
94
97
}
95
98
Original file line number Diff line number Diff line change @@ -57,15 +57,15 @@ export const VersionFooter = ({
57
57
58
58
mutate (
59
59
`/api/document?id=${ artifact . documentId } ` ,
60
- await fetch ( `/api/document?id= ${ artifact . documentId } ` , {
61
- method : 'PATCH' ,
62
- body : JSON . stringify ( {
63
- timestamp : getDocumentTimestampByIndex (
64
- documents ,
65
- currentVersionIndex ,
66
- ) ,
67
- } ) ,
68
- } ) ,
60
+ await fetch (
61
+ `/api/document?id= ${ artifact . documentId } ×tamp= ${ getDocumentTimestampByIndex (
62
+ documents ,
63
+ currentVersionIndex ,
64
+ ) } ` ,
65
+ {
66
+ method : 'DELETE' ,
67
+ } ,
68
+ ) ,
69
69
{
70
70
optimisticData : documents
71
71
? [
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " ai-chatbot" ,
3
- "version" : " 3.0.1 " ,
3
+ "version" : " 3.0.2 " ,
4
4
"private" : true ,
5
5
"scripts" : {
6
6
"dev" : " next dev --turbo" ,
You can’t perform that action at this time.
0 commit comments