diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/oauth2/groups.py | 8 | ||||
-rw-r--r-- | wqflask/wqflask/oauth2/request_utils.py | 5 | ||||
-rw-r--r-- | wqflask/wqflask/templates/oauth2/group.html | 6 |
3 files changed, 15 insertions, 4 deletions
diff --git a/wqflask/wqflask/oauth2/groups.py b/wqflask/wqflask/oauth2/groups.py index 551c0640..3bc5fb6d 100644 --- a/wqflask/wqflask/oauth2/groups.py +++ b/wqflask/wqflask/oauth2/groups.py @@ -9,7 +9,7 @@ from flask import ( from .checks import require_oauth2 from .client import oauth2_get, oauth2_post from .request_utils import ( - user_details, handle_error, request_error, process_error, handle_success, + user_details, handle_error, process_error, handle_success, raise_unimplemented) groups = Blueprint("group", __name__) @@ -32,8 +32,12 @@ def user_group(): user_error=process_error(error)), partial(__get_join_requests__, group)) + def __group_error__(err): + return render_template( + "oauth2/group.html", group_error=process_error(err)) + return oauth2_get("oauth2/user/group").either( - request_error, __success__) + __group_error__, __success__) @groups.route("/create", methods=["POST"]) @require_oauth2 diff --git a/wqflask/wqflask/oauth2/request_utils.py b/wqflask/wqflask/oauth2/request_utils.py index eefae900..fae3a347 100644 --- a/wqflask/wqflask/oauth2/request_utils.py +++ b/wqflask/wqflask/oauth2/request_utils.py @@ -20,10 +20,11 @@ def process_error(error: Response, "server.") ) -> dict: if error.status_code == 404: + msg = error.json()["error_description"] if hasattr(error, "json") else message return { "error": "NotFoundError", - "error_message": message, - "error_description": message, + "error_message": msg, + "error_description": msg, "status_code": error.status_code } return {**error.json(), "status_code": error.status_code} diff --git a/wqflask/wqflask/templates/oauth2/group.html b/wqflask/wqflask/templates/oauth2/group.html index a6a3e6c3..a2380df7 100644 --- a/wqflask/wqflask/templates/oauth2/group.html +++ b/wqflask/wqflask/templates/oauth2/group.html @@ -8,6 +8,11 @@ {{flash_me()}} + {%if group_error is defined%} + <div class="row" style="text-align:center;line-height:5em;"> + {{display_error("Group", group_error)}} + </div> + {%else%} <div class="container-fluid"> <div class="row"> {%if group_join_requests_error is defined %} @@ -103,6 +108,7 @@ </table> </div> + {%endif%} </div> {%endblock%} |