You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
983 B
35 lines
983 B
<script>
|
|
import { onMount } from "svelte"
|
|
let dz
|
|
|
|
onMount(async () => {
|
|
const dropzone = await import("dropzone")
|
|
dz = new dropzone.default("div#dropzone", {
|
|
url: "http://localhost:4000/graphql",
|
|
autoProcessQueue: true,
|
|
})
|
|
|
|
dz.on("sending", (file, xhr, data) => {
|
|
data.append(
|
|
"operations",
|
|
`{ "query": "mutation ($file: Upload!) { uploadFigure(file: $file)}", "variables": { "file": null } }`
|
|
)
|
|
data.append("map", `{ "file": ["variables.file"] }`)
|
|
})
|
|
})
|
|
</script>
|
|
|
|
<div id="dropzone" class="dropzone" cy="dropzone" />
|
|
|
|
<style>
|
|
.dropzone {
|
|
height: 300px;
|
|
background: #fdfdfd;
|
|
border-radius: 5px;
|
|
border: 2px dashed #ff3e00;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
transition: all 300ms ease-out;
|
|
}
|
|
</style>
|
|
|