Redirect - Unauthorized

Hello Everyone,

I would like to redirect the user to the login page if the server response is “Unauthorized”.
I’m using node/ejs, I already have the browser component on the main layout and in the partial, there is a reference to the main layout browser component, below, the header of the partial:

<!-- Wappler include is="dmx-app" id="_referral" appconnect="local" jquery_slim_35="local" fontawesome_4="local" bootstrap4="custom" fontawesome_5pro="cdn" components="{dmxAutocomplete:{},dmxBootbox:{},dmxStateManagement:{},dmxBootstrap4TableGenerator:{},dmxBootstrap4Modal:{},dmxBootstrap4Alert:{},dmxDropzone:{},dmxPreloader:{},dmxNotifications:{},dmxSockets:{},dmxBootstrap4Tooltips:{},dmxFormatter:{},dmxBrowser:{}}" head-page="layouts/main_layout" -->

But when accessing the page:

How to make this redirect to the login page automatically if the response is “unauthorized”?

Thanks and have a great week!

Community Page
Last updated: