File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ async function fetchCurrentUser() {
2222 method : 'POST' ,
2323 credentials : 'include' ,
2424 headers : { 'Content-Type' : 'application/json' } ,
25- body : {
25+ body : JSON . stringify ( {
2626 service : 'get-user'
27- }
27+ } )
2828 } ) ;
2929 if ( response . ok ) currentUser = await response . text ( ) ;
3030 } catch ( error ) {
@@ -37,9 +37,9 @@ async function loadMessages() {
3737 const response = await fetch ( '/api/' , {
3838 method : 'POST' ,
3939 headers : { 'Content-Type' : 'application/json' } ,
40- body : {
40+ body : JSON . stringify ( {
4141 service : 'get-messages'
42- }
42+ } )
4343 } ) ;
4444 const messages = await response . json ( ) ;
4545 displayMessages ( messages ) ;
@@ -79,10 +79,10 @@ async function sendMessage(content) {
7979 await fetch ( '/api/' , {
8080 method : 'POST' ,
8181 headers : { 'Content-Type' : 'application/json' } ,
82- body : {
82+ body : JSON . stringify ( {
8383 service : 'send-message' ,
8484 content
85- }
85+ } )
8686 } ) ;
8787 } catch ( error ) {
8888 console . error ( 'Error sending message:' , error ) ;
@@ -130,11 +130,11 @@ async function editMessage(messageId, newContent) {
130130 await fetch ( '/api/' , {
131131 method : 'POST' ,
132132 headers : { 'Content-Type' : 'application/json' } ,
133- body : {
133+ body : JSON . stringify ( {
134134 service : 'edit-message' ,
135135 id : messageId ,
136136 content : newContent
137- }
137+ } )
138138 } ) ;
139139 loadMessages ( ) ;
140140 } catch ( error ) {
@@ -150,10 +150,10 @@ async function deleteMessage(messageId) {
150150 await fetch ( '/api/' , {
151151 method : 'POST' ,
152152 headers : { 'Content-Type' : 'application/json' } ,
153- body : {
153+ body : JSON . stringify ( {
154154 service : 'delete-message' ,
155155 id : messageId
156- }
156+ } )
157157 } ) ;
158158 loadMessages ( ) ;
159159 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments