Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
image-board-svelte
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Trirst
image-board-svelte
Commits
a824f8fc
Commit
a824f8fc
authored
Oct 17, 2021
by
Trirst
Browse files
Options
Downloads
Patches
Plain Diff
Minor clean up
parent
3c026a31
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/routes/Upload.svelte
+0
-6
0 additions, 6 deletions
src/routes/Upload.svelte
with
0 additions
and
6 deletions
src/routes/Upload.svelte
+
0
−
6
View file @
a824f8fc
...
@@ -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
]
}
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment