This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit c4a735ac25a64b90a13ce8d91665f6c2fe4ff0e7 Author: Marcus Christie <[email protected]> AuthorDate: Thu Oct 20 18:10:43 2022 -0400 AIRAVATA-3647 Documenting utility methods --- .../static/django_airavata_api/js/errors/ErrorUtils.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/django_airavata/apps/api/static/django_airavata_api/js/errors/ErrorUtils.js b/django_airavata/apps/api/static/django_airavata_api/js/errors/ErrorUtils.js index b1213e42..d69f70f4 100644 --- a/django_airavata/apps/api/static/django_airavata_api/js/errors/ErrorUtils.js +++ b/django_airavata/apps/api/static/django_airavata_api/js/errors/ErrorUtils.js @@ -22,6 +22,14 @@ export default { isNotFoundError(error) { return this.isAPIException(error) && error.details.status === 404; }, + /** + * Return true if the error is an unauthenticated error, i.e., the user needs + * to log in again. + * + * @param {Error} error + * @returns + * @see {@link buildLoginUrl} for utility to build re-login url + */ isUnauthenticatedError(error) { return ( this.isAPIException(error) && @@ -30,6 +38,13 @@ export default { error.details.response.is_authenticated === false ); }, + /** + * Build a url that takes the user to the login page. + * + * @param {boolean} includeNextParameter - Add a 'next' url to the login url + * that will take the user back to this page after login + * @returns + */ buildLoginUrl(includeNextParameter = true) { let loginUrl = "/auth/login"; if (includeNextParameter) {
