fix file upload
This commit is contained in:
		| @@ -60,7 +60,9 @@ const handler: NextApiHandler = async (req, res) => { | ||||
|       }, | ||||
|       data: { | ||||
|         photo: { | ||||
|           name: getFileName((await uploadPhoto).filepath), | ||||
|           name: getFileName( | ||||
|             (await uploadPhoto).originalFilename ?? "resource ICON" | ||||
|           ), | ||||
|           data: photoBuffer, | ||||
|         }, | ||||
|       }, | ||||
|   | ||||
| @@ -60,9 +60,6 @@ const EditResourcePage = ( | ||||
|   }); | ||||
|  | ||||
|   const onSubmit: SubmitHandler<ResourceUpdateInput> = async (data) => { | ||||
|     // TODO: Fix file upload, currently it is not updating correctly on the server side | ||||
|     // May also need to look into re-rendering static pages when icon changes | ||||
|     // Also need to add authentication of route! | ||||
|     if (updateIconFile) { | ||||
|       const data = new FormData(); | ||||
|       data.append("photo", updateIconFile); | ||||
| @@ -75,8 +72,6 @@ const EditResourcePage = ( | ||||
|         } | ||||
|       ); | ||||
|  | ||||
|       console.log("uploading icon"); | ||||
|  | ||||
|       if (uploadResponse.status !== 200) { | ||||
|         setServerError( | ||||
|           "Failed uploading resource icon file. Changes did not save!" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user