Files
openfoodnetwork/app/webpacker/js/turbo.js
David Cook 574e8f0135 Show error message when turbo:frame-missing
Instead of replacing frame contents with unhelpful text 'Content missing'.
2024-04-23 16:48:52 +10:00

15 lines
365 B
JavaScript

import "@hotwired/turbo";
document.addEventListener("turbo:frame-missing", (event) => {
// don't replace frame contents
event.preventDefault();
// show error message instead
status = event.detail.response.status;
if(status == 401) {
alert(I18n.t("errors.unauthorized.message"));
} else {
alert(I18n.t("errors.general_error.message"));
}
});