chore: 🤖 add code comments and simplify conditional

This commit is contained in:
Randall Morey committed 2020-09-08 17:53:58 -04:00
1 parent c2ca39030b
commit 63f3651c44
1 file changed
+7 -2
+7 -2
View File
@@ -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;
}
}