diff --git a/ui/desktop/app/routes/application.js b/ui/desktop/app/routes/application.js index 8a17576f8..5ea39ff85 100644 --- a/ui/desktop/app/routes/application.js +++ b/ui/desktop/app/routes/application.js @@ -8,6 +8,7 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { A } from '@ember/array'; import { getOwner } from '@ember/application'; +import { notifyError } from 'core/decorators/notify'; export default class ApplicationRoute extends Route { // =services @@ -29,6 +30,7 @@ export default class ApplicationRoute extends Route { * reported by the main process. If they differ, update the main process * clusterUrl so that the renderer's CSP can be rewritten to allow requests. */ + @notifyError(({ message }) => message, { catch: true }) async beforeModel() { this.intl.setLocale(['en-us']); await this.session.setup(); @@ -39,7 +41,7 @@ export default class ApplicationRoute extends Route { // Add token to client daemon after a successful authentication restoration if (this.session.isAuthenticated) { const sessionData = this.session.data?.authenticated; - this.ipc.invoke('addTokenToClientDaemon', { + await this.ipc.invoke('addTokenToClientDaemon', { tokenId: sessionData?.id, token: sessionData?.token, }); diff --git a/ui/desktop/app/services/session.js b/ui/desktop/app/services/session.js index f3cf17c1d..bedc8d6f7 100644 --- a/ui/desktop/app/services/session.js +++ b/ui/desktop/app/services/session.js @@ -5,6 +5,7 @@ import { inject as service } from '@ember/service'; import BaseSessionService from 'ember-simple-auth/services/session'; +import { notifyError } from 'core/decorators/notify'; export default class SessionService extends BaseSessionService { @service ipc; @@ -13,12 +14,13 @@ export default class SessionService extends BaseSessionService { * Extend ember simple auth's handleAuthentication method * so we can hook in and add the user's token to the client daemon */ - handleAuthentication() { + @notifyError(({ message }) => message, { catch: true }) + async handleAuthentication() { super.handleAuthentication(...arguments); if (this.session.isAuthenticated) { const sessionData = this.data?.authenticated; - this.ipc.invoke('addTokenToClientDaemon', { + await this.ipc.invoke('addTokenToClientDaemon', { tokenId: sessionData?.id, token: sessionData?.token, });