How to redirect if jwt is not presented in the request using Flask-jwt-extended

Solution
@jwt.unauthorized_loader
def custom_unauthorized_response(_err):
    return redirect(url_for('login'))
def jwt_or_redirect():
    def wrapper(fn):
        @wraps(fn)
        def decorator(*args, **kwargs):
            verify_jwt_in_request(optional=True)
            if not get_jwt_identity():
                return redirect(url_for('login'))
            else:
                return fn(*args, **kwargs)

        return decorator

    return wrapper