Skip to content

Commit fcd7f6c

Browse files
authored
Use click trigger to remove active toast notifications
1 parent b40fe0c commit fcd7f6c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

page-foundation.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ $.ajaxSetup({
66
method: 'POST',
77
statusCode: {
88
401: function() {
9-
toastr.remove();
9+
$('#toast-container .toast').trigger('click');
1010
if (typeof Ladda != 'undefined') {
1111
Ladda.stopAll();
1212
}
1313
toastr.error("Sorry, you do not have permission. Reloading page...", '401 Unauthorized', {timeOut: 0});
1414
window.location.reload(true);
1515
},
1616
404: function() {
17-
toastr.remove();
17+
$('#toast-container .toast').trigger('click');
1818
if (typeof Ladda != 'undefined') {
1919
Ladda.stopAll();
2020
}
@@ -23,7 +23,7 @@ $.ajaxSetup({
2323
},
2424
dataFilter: function(data, type) {
2525
if (data.substring(0, 4) === 'http') {
26-
toastr.remove();
26+
$('#toast-container .toast').trigger('click');
2727
toastr.info("Loading page...", '', {timeOut: 0});
2828
if (window.location.href == data) {
2929
location.reload(true);
@@ -38,7 +38,7 @@ $.ajaxSetup({
3838
},
3939
complete: function(jqXHR, textStatus) {
4040
if (jqXHR.getResponseHeader('X-FORCE_FRONTEND_REDIRECT') === '1') {
41-
toastr.remove();
41+
$('#toast-container .toast').trigger('click');
4242
if (typeof Ladda != 'undefined') {
4343
Ladda.stopAll();
4444
}
@@ -52,22 +52,22 @@ $.ajaxSetup({
5252
case 'error':
5353
// Server errors.
5454
if (jqXHR.status >= 500) {
55-
toastr.remove();
55+
$('#toast-container .toast').trigger('click');
5656
if (typeof Ladda != 'undefined') {
5757
Ladda.stopAll();
5858
}
5959
toastr.error("Houston, we have a problem.", 'An error occurred :(', {timeOut: 0});
6060
}
6161
break;
6262
case 'timeout':
63-
toastr.remove();
63+
$('#toast-container .toast').trigger('click');
6464
if (typeof Ladda != 'undefined') {
6565
Ladda.stopAll();
6666
}
6767
toastr.error("Looks like we got stuck in the slow lane.", 'A timeout occurred :(', {timeOut: 0});
6868
break;
6969
case 'parsererror':
70-
toastr.remove();
70+
$('#toast-container .toast').trigger('click');
7171
if (typeof Ladda != 'undefined') {
7272
Ladda.stopAll();
7373
}
@@ -77,7 +77,7 @@ $.ajaxSetup({
7777

7878
if (jqXHR.getResponseHeader('X-TOASTR') != '') {
7979
var toastr_messages = JSON.parse(jqXHR.getResponseHeader('X-TOASTR'));
80-
toastr.remove();
80+
$('#toast-container .toast').trigger('click');
8181

8282
$.each(toastr_messages, function(key, value) {
8383
toastr[key](value);

0 commit comments

Comments
 (0)