Skip to content

Commit d299d85

Browse files
committed
only share auth if present
1 parent 7b66f75 commit d299d85

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

frontend/src/utils/AuthService.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,15 @@ export default class AuthService {
201201
"message",
202202
({ data }: MessageEvent<AuthEventDetail>) => {
203203
if (data.name === "requesting_auth") {
204-
// A new tab/window opened and is requesting shared auth
205-
AuthService.broadcastChannel.postMessage({
206-
name: "responding_auth",
207-
auth: AuthService.getCurrentTabAuth(),
208-
} as AuthResponseEventDetail);
204+
const auth = AuthService.getCurrentTabAuth();
205+
206+
if (auth) {
207+
// A new tab/window opened and is requesting shared auth
208+
AuthService.broadcastChannel.postMessage({
209+
name: "responding_auth",
210+
auth: AuthService.getCurrentTabAuth(),
211+
} as AuthResponseEventDetail);
212+
}
209213
}
210214
},
211215
);

0 commit comments

Comments
 (0)