diff --git a/web/app/routes/application.js b/web/app/routes/application.js index 2a6de7388..636ec76fa 100644 --- a/web/app/routes/application.js +++ b/web/app/routes/application.js @@ -1,4 +1,6 @@ import Route from "@ember/routing/route"; +import { UnauthorizedError } from "@ember-data/adapter/error"; +import { action } from "@ember/object"; import config from "hermes/config/environment"; import { inject as service } from "@ember/service"; @@ -8,6 +10,14 @@ export default class ApplicationRoute extends Route { @service flags; @service session; + @action + error(error) { + if (error instanceof UnauthorizedError) { + this.session.invalidate(); + return; + } + } + async beforeModel() { await this.session.setup();