From 63f3651c44322e20b09696f5e9aa609954d3736e Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 8 Sep 2020 17:53:58 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20code=20comments?= =?UTF-8?q?=20and=20simplify=20conditional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/routes/application.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/core/app/routes/application.js b/ui/core/app/routes/application.js index 0874bb7f0..0a6c58271 100644 --- a/ui/core/app/routes/application.js +++ b/ui/core/app/routes/application.js @@ -60,14 +60,19 @@ export default class ApplicationRoute extends Route.extend( this.session.invalidate(); } + /** + * Invalidates the session if a 401 error occurs and returns false to + * prevent further error handling. + * Returns true in all other cases, allowing error handling to occur (such + * as displaying the `error.hbs` template, if one exists). + */ @action error(e) { const isUnauthenticated = e?.errors[0]?.isUnauthenticated; if (isUnauthenticated) { this.session.invalidate(); return false; - } else { - return true; } + return true; } }