function generateErrorCallback()

in public/src/js/modules/authed-ajax.js [15:35]


function generateErrorCallback (win, reject, retry) {
    win = win || window;
    function redirect (xhr) {
        win.location.reload(true);
        reject(xhr);
    }
    return function (xhr) {
        if (xhr.status === 403 || xhr.status === 401) {
            redirect(xhr);
        } else if (xhr.status === 419) {
            if (retry) {
                // Try once more after re-auth
                reauth().then(retry).catch(redirect);
            } else {
                redirect(xhr);
            }
        } else {
            reject(xhr);
        }
    };
}