File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 9494 }
9595
9696 function uploadToServer ( file ) {
97- const formData = new FormData ( )
98- formData . append ( 'image' , file , file . name )
99- const url = 'http://localhost:3000/image-upload-api'
100- console . log ( 'calling api' , url , 'with data' , Array . from ( formData . entries ( ) ) [ 0 ] )
101- return fetch ( url , {
102- method : 'POST' ,
103- body : formData
104- } ) . then ( res => res . json ( ) )
105- . then ( body => console . log ( 'got server response' , body ) )
97+ // const formData = new FormData()
98+ // formData.append('image', file, file.name)
99+ // const url = 'http://localhost:3000/image-upload-api'
100+ // console.log('calling api', url, 'with data', Array.from(formData.entries())[0])
101+ // return fetch(url, {
102+ // method: 'POST',
103+ // body: formData
104+ // }).then(res => res.json())
105+ // .then(body => console.log('got server response', body))
106106 }
107107</ script >
108108</ body >
You can’t perform that action at this time.
0 commit comments