From 05b2e041cf66e6a1aaa9148dd96b2a5d4ce37459 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sat, 3 Mar 2018 19:58:18 +0100 Subject: [PATCH] Increased upload message duration --- scripts/Actions/Upload.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/Actions/Upload.ts b/scripts/Actions/Upload.ts index e176271f..08937e96 100644 --- a/scripts/Actions/Upload.ts +++ b/scripts/Actions/Upload.ts @@ -1,4 +1,5 @@ import { AnimeNotifier } from "../AnimeNotifier" +import { StatusMessage } from "../StatusMessage" // Select file export function selectFile(arn: AnimeNotifier, button: HTMLButtonElement) { @@ -13,6 +14,11 @@ export function selectFile(arn: AnimeNotifier, button: HTMLButtonElement) { return } + if(!file.type.startsWith("image/")) { + arn.statusMessage.showError(file.name + " is not an image file!") + return + } + previewImage(file, preview) uploadFile(file, "/api/upload/avatar", arn) } @@ -43,7 +49,7 @@ function uploadFile(file: File, endpoint: string, arn: AnimeNotifier) { let reader = new FileReader() reader.onloadend = async () => { - arn.statusMessage.showInfo("Uploading avatar...") + arn.statusMessage.showInfo("Uploading avatar...", 60000) let response = await fetch(endpoint, { method: "POST",