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