Increased upload message duration

This commit is contained in:
Eduard Urbach 2018-03-03 19:58:18 +01:00
parent a1c3fc5468
commit 05b2e041cf

View File

@ -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",