Skip to content

Commit f962dd6

Browse files
authored
Merge pull request #19376 from mozilla/FXA-12299
bug(setting): Fix issue with empty session in cache.
2 parents e706aec + 213432f commit f962dd6

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

packages/fxa-settings/src/models/Session.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,22 @@ export class Session implements SessionData {
6969
}
7070
}
7171

72-
private get data() {
73-
const { session } = this.apolloClient.cache.readQuery<{
72+
private get data(): Session | undefined {
73+
const result = this.apolloClient.cache.readQuery<{
7474
session: Session;
7575
}>({
7676
query: GET_SESSION_VERIFIED,
77-
})!;
78-
return session;
77+
});
78+
79+
return result?.session;
7980
}
8081

8182
get token(): string {
82-
return this.data.token;
83+
return this.data?.token || '';
8384
}
8485

8586
get verified(): boolean {
86-
return this.data.verified;
87+
return this.data?.verified || false;
8788
}
8889

8990
// TODO: Use GQL verifyCode instead of authClient

0 commit comments

Comments
 (0)