I have a button that shows a spinner on a modal dialog while a utility hook is executed. The problem is when I leave a browser tab open for a few days, that session times out but I can still click that button which opens a modal. When that happens, the modal remains open but the user is redirected to the login screen. I’d prefer to not open the modal at all (or close it, at least) in this case. Is there a way to detect this scenario?
Here’s the actions run by the button:
[{
"action": "showModal",
"nonBlocking": true,
"options": {
"body": "<i class=\"fa fa-spinner fa-spin fa-3x fa-fw\"></i>Please wait while we prepare your invoice ...",
"icon": "",
"options": {
"blocking": true,
"buttons": [],
"hideCloseButton": false
},
"overlayTheme": "dark",
"text": "Processing ..."
}
}, {
"action": "runUtilityHook",
"function": "action.options.id = model.permit.id",
"options": {
"modelFilterKeys": [],
"type": "download-invoice"
}
}]