better toasts

This commit is contained in:
jonaswinkler
2020-12-28 21:52:09 +01:00
parent a881a7ee4f
commit 619e25d71b
5 changed files with 23 additions and 32 deletions

View File

@@ -2,7 +2,7 @@ import { HttpEventType } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { FileSystemFileEntry, NgxFileDropEntry } from 'ngx-file-drop';
import { DocumentService } from 'src/app/services/rest/document.service';
import { Toast, ToastService } from 'src/app/services/toast.service';
import { ToastService } from 'src/app/services/toast.service';
interface UploadStatus {
@@ -60,7 +60,7 @@ export class UploadFileWidgetComponent implements OnInit {
} else if (event.type == HttpEventType.Response) {
this.uploadStatus.splice(this.uploadStatus.indexOf(uploadStatusObject), 1)
this.completedFiles += 1
this.toastService.showToast(Toast.make("Information", $localize`The document has been uploaded and will be processed by the consumer shortly.`))
this.toastService.showInfo($localize`The document has been uploaded and will be processed by the consumer shortly.`)
}
}, error => {
@@ -68,11 +68,11 @@ export class UploadFileWidgetComponent implements OnInit {
this.completedFiles += 1
switch (error.status) {
case 400: {
this.toastService.showToast(Toast.makeError($localize`There was an error while uploading the document: ${error.error.document}`))
this.toastService.showInfo($localize`There was an error while uploading the document: ${error.error.document}`)
break;
}
default: {
this.toastService.showToast(Toast.makeError($localize`An error has occurred while uploading the document. Sorry!`))
this.toastService.showInfo($localize`An error has occurred while uploading the document. Sorry!`)
break;
}
}