Skip to content

Commit 3302098

Browse files
committed
Merge branch 'develop'
2 parents 3632c32 + bf68f2b commit 3302098

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
3232
"test": "npm run lint && npm run jest"
3333
},
34-
"version": "0.4.0",
34+
"version": "0.4.1",
3535
"dependencies": {
3636
"auth0-js": "^6.8.4",
3737
"isomorphic-fetch": "^2.2.1",

src/services/user.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ import { getApiResponsePayloadV3 } from '../utils/tc';
1010
import { getApiV2, getApiV3 } from './api';
1111

1212
let auth0;
13-
if (isomorphy.isClientSide()) {
14-
const Auth0 = require('auth0-js'); /* eslint-disable-line global-require */
15-
auth0 = new Auth0({
16-
domain: config.AUTH0.DOMAIN,
17-
clientID: config.AUTH0.CLIENT_ID,
18-
callbackOnLocationHash: true,
19-
sso: false,
20-
});
13+
14+
/**
15+
* Returns a new, or cached auth0 instance.
16+
* @return {Object} Auth0 object.
17+
*/
18+
function getAuth0() {
19+
if (!auth0 && isomorphy.isClientSide()) {
20+
const Auth0 = require('auth0-js'); /* eslint-disable-line global-require */
21+
auth0 = new Auth0({
22+
domain: config.AUTH0.DOMAIN,
23+
clientID: config.AUTH0.CLIENT_ID,
24+
callbackOnLocationHash: true,
25+
sso: false,
26+
});
27+
}
28+
return auth0;
2129
}
2230

2331
/**
@@ -258,7 +266,7 @@ class User {
258266
*/
259267
async linkExternalAccount(userId, provider, callbackUrl) {
260268
return new Promise((resolve, reject) => {
261-
auth0.signin(
269+
getAuth0().signin(
262270
{
263271
popup: true,
264272
connection: provider,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy