mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-11-12 16:03:50 +00:00
prepare sending image to server
This commit is contained in:
parent
60fd19cb17
commit
f9d2d9fd72
@ -9,9 +9,7 @@
|
||||
|
||||
let imageURL: string, uploadData: UploadData;
|
||||
|
||||
async function sendImage(data: ImageData) {}
|
||||
|
||||
async function loadImage(url: string): Promise<ImageData> {}
|
||||
async function sendImage() {}
|
||||
|
||||
function uploadImage(event: Event) {
|
||||
// Revoke previous image url, if any
|
||||
@ -30,17 +28,12 @@
|
||||
<input type="file" name="image" accept="image/*" on:change={uploadImage} />
|
||||
{#if imageURL}
|
||||
<img src={imageURL} alt="User uploaded" />
|
||||
{#await loadImage(imageURL)}
|
||||
<p>Loading image data . . .</p>
|
||||
{#await sendImage()}
|
||||
<p>Sending image . . .</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{:then data}
|
||||
{#await sendImage(data)}
|
||||
<p>Uploading image data . . .</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{:then}
|
||||
<p>Done!</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{clearInterval(uploadData.interval)}
|
||||
{/await}
|
||||
{:then}
|
||||
<p>Done!</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{clearInterval(uploadData.interval)}
|
||||
{/await}
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user