Skip to content
Snippets Groups Projects
Commit a824f8fc authored by Trirst's avatar Trirst
Browse files

Minor clean up

parent 3c026a31
Branches
No related tags found
No related merge requests found
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
function validImageTypes(file) { function validImageTypes(file) {
return acceptedTypes.includes(file.type); return acceptedTypes.includes(file.type);
} }
function updatePreviews() { function updatePreviews() {
previews = []; previews = [];
for (const file of imageUpload.files) { for (const file of imageUpload.files) {
...@@ -20,7 +19,6 @@ ...@@ -20,7 +19,6 @@
} }
} }
} }
async function postImages() { async function postImages() {
let formData = new FormData(); let formData = new FormData();
let i = 0; let i = 0;
...@@ -36,7 +34,6 @@ ...@@ -36,7 +34,6 @@
imageUpload.value = null; imageUpload.value = null;
previews = []; previews = [];
} }
async function post1Image(formData) { async function post1Image(formData) {
const options = { const options = {
method: "POST", method: "POST",
...@@ -48,12 +45,10 @@ ...@@ -48,12 +45,10 @@
const imageMetadata = await fetchAPI(paths.Image, options); const imageMetadata = await fetchAPI(paths.Image, options);
return imageMetadata; return imageMetadata;
} }
// Serialize image metada fields into JSON string that can be sent to API endpoints // Serialize image metada fields into JSON string that can be sent to API endpoints
function serializeForm(form) { function serializeForm(form) {
return JSON.stringify(Object.fromEntries(new FormData(form))); return JSON.stringify(Object.fromEntries(new FormData(form)));
} }
function updateImageMetadata(snowflake, metadata) { function updateImageMetadata(snowflake, metadata) {
const options = { const options = {
method: "PATCH", method: "PATCH",
...@@ -77,7 +72,6 @@ ...@@ -77,7 +72,6 @@
/> />
<button on:click={postImages}>Submit</button> <button on:click={postImages}>Submit</button>
</div> </div>
<!-- {(console.log(forms), "")} -->
{#each previews as preview, i} {#each previews as preview, i}
<div class="flex flex-row space-x-6 m-4"> <div class="flex flex-row space-x-6 m-4">
<form class="flex flex-col flex-1 space-y-6" bind:this={forms[i]}> <form class="flex flex-col flex-1 space-y-6" bind:this={forms[i]}>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment