Skip to content

Commit 30ad81e

Browse files
committed
services/session: Extract windowEventWatcherTask
This just calls `waitForEvent()` for now, same as before.
1 parent 75bad22 commit 30ad81e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/services/session.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default class SessionService extends Service {
7272
let { url } = await ajax(`/api/private/session/begin`);
7373
win.location = url;
7474

75-
let event = await race([waitForEvent(window, 'message'), this.windowCloseWatcherTask.perform(win)]);
75+
let event = await race([this.windowEventWatcherTask.perform(), this.windowCloseWatcherTask.perform(win)]);
7676
if (event.closed) {
7777
this.notifications.warning('Login was canceled because the popup window was closed.');
7878
return;
@@ -111,6 +111,10 @@ export default class SessionService extends Service {
111111
}
112112
});
113113

114+
windowEventWatcherTask = task(async () => {
115+
return await waitForEvent(window, 'message');
116+
});
117+
114118
windowCloseWatcherTask = task(async window => {
115119
// eslint-disable-next-line no-constant-condition
116120
while (true) {

0 commit comments

Comments
 (0)