chore: 🤖 add code comments and simplify conditional
This commit is contained in:
1 file changed
+7
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user