Skip to content

Commit

Permalink
Implement timeout support to networking Client
Browse files Browse the repository at this point in the history
  • Loading branch information
mnylen committed Oct 31, 2021
1 parent 77fb1f2 commit bb47005
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 44 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Auth from './src/auth';
import Users from './src/management/users';
import WebAuth from './src/webauth';
export {TimeoutError} from './src/utils/fetchWithTimeout';

/**
* Auth0 for React Native client
Expand All @@ -9,7 +10,6 @@ import WebAuth from './src/webauth';
* @class Auth0
*/
export default class Auth0 {

/**
* Creates an instance of Auth0.
* @param {Object} options your Auth0 application information
Expand All @@ -19,7 +19,7 @@ export default class Auth0 {
* @memberof Auth0
*/
constructor(options = {}) {
const { domain, clientId, ...extras } = options;
const {domain, clientId, ...extras} = options;
this.auth = new Auth({baseUrl: domain, clientId, ...extras});
this.webAuth = new WebAuth(this.auth);
this.options = options;
Expand All @@ -31,7 +31,7 @@ export default class Auth0 {
* @return {Users}
*/
users(token) {
const { domain, clientId, ...extras } = this.options;
const {domain, clientId, ...extras} = this.options;
return new Users({baseUrl: domain, clientId, ...extras, token});
}
};
}
21 changes: 21 additions & 0 deletions src/auth/__tests__/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -60,6 +61,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -75,6 +77,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -104,6 +107,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -134,6 +138,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -149,6 +154,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -164,6 +170,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -199,6 +206,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -214,6 +222,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -229,6 +238,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -244,6 +254,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -259,6 +270,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -274,6 +286,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -289,6 +302,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -304,6 +318,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -319,6 +334,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -334,6 +350,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -349,6 +366,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -382,6 +400,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -403,6 +422,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -443,6 +463,7 @@ Array [
"Content-Type": "application/json",
},
"method": "GET",
"signal": AbortSignal {},
},
]
`;
2 changes: 2 additions & 0 deletions src/management/__tests__/__snapshots__/users.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Array [
"Content-Type": "application/json",
},
"method": "GET",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -261,6 +262,7 @@ Array [
"Content-Type": "application/json",
},
"method": "PATCH",
"signal": AbortSignal {},
},
]
`;
Expand Down
6 changes: 6 additions & 0 deletions src/networking/__tests__/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Array [
"Content-Type": "application/json",
},
"method": "GET",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -28,6 +29,7 @@ Array [
"Content-Type": "application/json",
},
"method": "GET",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -77,6 +79,7 @@ Array [
"Content-Type": "application/json",
},
"method": "PATCH",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -92,6 +95,7 @@ Array [
"Content-Type": "application/json",
},
"method": "PATCH",
"signal": AbortSignal {},
},
]
`;
Expand Down Expand Up @@ -141,6 +145,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand All @@ -156,6 +161,7 @@ Array [
"Content-Type": "application/json",
},
"method": "POST",
"signal": AbortSignal {},
},
]
`;
Expand Down
Loading

0 comments on commit bb47005

Please sign in to comment.