diff --git a/ui/resources/views/emails/messages.blade.php b/ui/resources/views/emails/messages.blade.php index 2542956..47101f3 100644 --- a/ui/resources/views/emails/messages.blade.php +++ b/ui/resources/views/emails/messages.blade.php @@ -221,7 +221,13 @@ }, messages: () => { const uri = '/mailbox/{{$mailbox_id}}/messages/valid' - return Send.get(uri).then(response => { + return Send.get(uri).then((response, status, jqXHR) => { + if (parseInt(jqXHR.status/100) !== 2 || jqXHR.status === 204) { + $(this.id.results).html('').append( + this.draw().empty() + ) + return + } if (this.total === null) { $(this.id.count).html(' (' + response.total + ')') this.total = response.total @@ -384,6 +390,7 @@ ) }, empty: () => { + $(this.id.count).html(' (0)') return $('
').addClass('ui message').html('No messages found.') } } @@ -448,4 +455,4 @@ messages.setup() }) -@endpush \ No newline at end of file +@endpush diff --git a/ui/resources/views/home.blade.php b/ui/resources/views/home.blade.php index 6b50b7c..4909b55 100644 --- a/ui/resources/views/home.blade.php +++ b/ui/resources/views/home.blade.php @@ -14,7 +14,8 @@ const uri = '/mailboxes/registered' this.draw().loading() return Send.get(uri).then((response, status, jqXHR) => { - if (parseInt(jqXHR.status / 100) !== 2) { + if (parseInt(jqXHR.status / 100) !== 2 || jqXHR.status === 204) { + this.draw().empty() return } if (jqXHR.status === 200) { @@ -44,7 +45,7 @@ const parent = $(this.div_id) parent.html('') if (this.mailboxes.length === 0) { - parent.html('No mailboxes registered.') + this.draw().empty() return } const list = $('
').addClass('ui list') @@ -54,6 +55,13 @@ ) }) parent.append(list) + }, + empty: () => { + const parent = $(this.div_id) + parent.html('') + parent.append( + $('
').addClass('ui message').html('No mailboxes registered.') + ) } } } @@ -63,4 +71,4 @@ mailboxes.get() }) -@endpush \ No newline at end of file +@endpush