Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit 2d8d2ca

Browse files
committed
Check if PubSub is set up before setting token.
1 parent 30e6370 commit 2d8d2ca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Entities/User.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,17 @@ export class User extends Entity {
116116
if (currentToken !== token) {
117117
if (token === '') {
118118
Nymph.setXsrfToken(null);
119-
PubSub.setToken(null);
119+
if (PubSub.pubsubURL != null) {
120+
PubSub.setToken(null);
121+
}
120122
} else {
121123
const base64Url = token.split('.')[1];
122124
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
123125
const jwt = JSON.parse(atob(base64));
124126
Nymph.setXsrfToken(jwt.xsrfToken);
125-
PubSub.setToken(token);
127+
if (PubSub.pubsubURL != null) {
128+
PubSub.setToken(token);
129+
}
126130
}
127131
}
128132
currentToken = token;

0 commit comments

Comments
 (0)