File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,14 @@ export default (opts = {}) => {
101
101
if ( api && typeof api === 'object' ) return setOpts ( api )
102
102
103
103
return new Promise ( ( resolve , reject ) => {
104
- if ( ! Number . isInteger ( id ) && typeof id !== 'string' ) {
105
- contextData = jwt
106
- jwt = body
107
- body = id
108
- id = null
104
+ const idWellFormed = Number . isFinite ( + id ) || typeof id === 'string'
105
+
106
+ if ( ! idWellFormed ) {
107
+ if ( jwt ) contextData = jwt
108
+ if ( typeof body === 'string' ) jwt = body
109
+ if ( typeof id === 'object' ) body = id
110
+
111
+ id = undefined
109
112
}
110
113
111
114
const handleError = ( e ) => {
@@ -120,7 +123,8 @@ export default (opts = {}) => {
120
123
}
121
124
122
125
if ( typeof body !== 'object' ) {
123
- jwt = body
126
+ if ( jwt ) contextData = jwt
127
+ if ( typeof body === 'string' ) jwt = body
124
128
body = undefined
125
129
}
126
130
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " get-scrud" ,
3
- "version" : " 2.0.0-beta.1 " ,
3
+ "version" : " 2.0.0-beta.2 " ,
4
4
"description" : " Client for SCRUD style rest APIs" ,
5
5
"main" : " index.js" ,
6
6
"type" : " module" ,
You can’t perform that action at this time.
0 commit comments