Is there route events for on ajax call start and ajax call fail?

hi , in my framework when you call to a route which requires use login … if user is not logged and request is not ajax user gets redirect to login page … but if request is ajax … it returns this json string {error:Unauthenticated}

also in the header it returns
Status code:401 Unauthorized

how can i handle this in all my routes so if a page route returns this json object {error:Unauthenticated} i can redirect user to login route ?

i tried to catch it in route events

var f7app = new Framework7({
    root: '#app',
    name: 'My App',
    id: 'com.myapp.test',
    on: {
        pageMounted: function (e, page) {

        pageAfterIn: function (e, page) {

        pageInit: function (e, page) {

        } ,
        pageBeforeRemove: function (e, page) {
    } ,

but all events fire after ajax call to page is done successfully … is there an event for before ajax call and after ajax call failed ?

routerAjaxStart: function (xhr, options) {
routerAjaxError: function (xhr, options) {
1 Like