apax-react-core
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -7,2 +7,9 @@ ## Changelog | ||
## [1.1.6] - 2021-07-15 | ||
### Changed | ||
- Add fix for axios. | ||
- Update tests | ||
## [1.1.2] - 2021-05-21 | ||
@@ -9,0 +16,0 @@ |
@@ -307,2 +307,6 @@ import Cookies from 'universal-cookie'; | ||
var validateStatus = function validateStatus() { | ||
return true; | ||
}; | ||
function getHeaders(options) { | ||
@@ -372,4 +376,11 @@ var headers, authenticationRequired, customHeaders, token, token_type; | ||
return axios.post(apiRoot + '/' + path, data, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return get(res, 'data', res); | ||
@@ -422,4 +433,11 @@ }); | ||
return axios.get(url, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return get(res, 'data', res); | ||
@@ -460,4 +478,11 @@ }); | ||
return axios.put(url, data, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return get(res, 'data', res); | ||
@@ -498,4 +523,11 @@ }); | ||
return axios.patch(url, data, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return get(res, 'data', res); | ||
@@ -535,2 +567,7 @@ }); | ||
return axios.delete(url, headers).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return get(res, 'data', res); | ||
@@ -623,9 +660,25 @@ }); | ||
if (!(!response.status || response.status > 299)) { | ||
_context.next = 10; | ||
break; | ||
} | ||
_context.next = 8; | ||
return put({ | ||
type: SIGNUP_ERROR, | ||
error: get(response, 'data') | ||
}); | ||
case 8: | ||
_context.next = 17; | ||
break; | ||
case 10: | ||
response['nextRoute'] = formData.nextRoute; | ||
// Persist token for future page loads | ||
_context.next = 8; | ||
_context.next = 13; | ||
return select(getTokenName); | ||
case 8: | ||
case 13: | ||
tokenName = _context.sent; | ||
@@ -635,16 +688,16 @@ | ||
_context.next = 12; | ||
_context.next = 17; | ||
return put(_extends({ type: SIGNUP_SUCCESS }, response)); | ||
case 12: | ||
_context.next = 18; | ||
case 17: | ||
_context.next = 23; | ||
break; | ||
case 14: | ||
_context.prev = 14; | ||
case 19: | ||
_context.prev = 19; | ||
_context.t0 = _context['catch'](1); | ||
_context.next = 18; | ||
_context.next = 23; | ||
return put({ type: SIGNUP_ERROR, error: get(_context.t0, 'response.data', _context.t0) }); | ||
case 18: | ||
case 23: | ||
case 'end': | ||
@@ -654,3 +707,3 @@ return _context.stop(); | ||
} | ||
}, _marked$2, this, [[1, 14]]); | ||
}, _marked$2, this, [[1, 19]]); | ||
} | ||
@@ -672,9 +725,25 @@ | ||
if (!(!response.status || response.status > 299)) { | ||
_context2.next = 10; | ||
break; | ||
} | ||
_context2.next = 8; | ||
return put({ | ||
type: LOGIN_ERROR, | ||
error: get(response, 'data') | ||
}); | ||
case 8: | ||
_context2.next = 17; | ||
break; | ||
case 10: | ||
response['nextRoute'] = formData.nextRoute; | ||
// Persist token for future page loads | ||
_context2.next = 8; | ||
_context2.next = 13; | ||
return select(getTokenName); | ||
case 8: | ||
case 13: | ||
tokenName = _context2.sent; | ||
@@ -684,16 +753,16 @@ | ||
_context2.next = 12; | ||
_context2.next = 17; | ||
return put(_extends({ type: LOGIN_SUCCESS }, response)); | ||
case 12: | ||
_context2.next = 18; | ||
case 17: | ||
_context2.next = 23; | ||
break; | ||
case 14: | ||
_context2.prev = 14; | ||
case 19: | ||
_context2.prev = 19; | ||
_context2.t0 = _context2['catch'](1); | ||
_context2.next = 18; | ||
_context2.next = 23; | ||
return put({ type: LOGIN_ERROR, error: get(_context2.t0, 'response.data', _context2.t0) }); | ||
case 18: | ||
case 23: | ||
case 'end': | ||
@@ -703,3 +772,3 @@ return _context2.stop(); | ||
} | ||
}, _marked2$1, this, [[1, 14]]); | ||
}, _marked2$1, this, [[1, 19]]); | ||
} | ||
@@ -787,22 +856,28 @@ | ||
formData = action$$1.formData; | ||
_context4.prev = 1; | ||
_context4.next = 4; | ||
_context4.next = 3; | ||
return call(api.patchUser, formData); | ||
case 4: | ||
case 3: | ||
response = _context4.sent; | ||
if (!(!response.status || response.status > 299)) { | ||
_context4.next = 9; | ||
break; | ||
} | ||
_context4.next = 7; | ||
return put({ type: PATCH_USER_SUCCESS, response: response }); | ||
return put({ | ||
type: PATCH_USER_ERROR, | ||
error: get(response, 'data') | ||
}); | ||
case 7: | ||
_context4.next = 13; | ||
_context4.next = 11; | ||
break; | ||
case 9: | ||
_context4.prev = 9; | ||
_context4.t0 = _context4['catch'](1); | ||
_context4.next = 13; | ||
return put({ type: PATCH_USER_ERROR, error: get(_context4.t0, 'response.data', _context4.t0) }); | ||
_context4.next = 11; | ||
return put({ type: PATCH_USER_SUCCESS, response: response }); | ||
case 13: | ||
case 11: | ||
case 'end': | ||
@@ -812,3 +887,3 @@ return _context4.stop(); | ||
} | ||
}, _marked4$1, this, [[1, 9]]); | ||
}, _marked4$1, this); | ||
} | ||
@@ -815,0 +890,0 @@ |
@@ -313,2 +313,6 @@ 'use strict'; | ||
var validateStatus = function validateStatus() { | ||
return true; | ||
}; | ||
function getHeaders(options) { | ||
@@ -378,4 +382,11 @@ var headers, authenticationRequired, customHeaders, token, token_type; | ||
return axios.post(apiRoot + '/' + path, data, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return _.get(res, 'data', res); | ||
@@ -428,4 +439,11 @@ }); | ||
return axios.get(url, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return _.get(res, 'data', res); | ||
@@ -466,4 +484,11 @@ }); | ||
return axios.put(url, data, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return _.get(res, 'data', res); | ||
@@ -504,4 +529,11 @@ }); | ||
return axios.patch(url, data, { | ||
headers: headers | ||
headers: headers, | ||
// Always return true so error status 4xx promises aren't rejected. | ||
validateStatus: validateStatus | ||
}).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return _.get(res, 'data', res); | ||
@@ -541,2 +573,7 @@ }); | ||
return axios.delete(url, headers).then(function (res) { | ||
// If the status is not a success, return all of the response | ||
if (res.status > 299) { | ||
return res; | ||
} | ||
return _.get(res, 'data', res); | ||
@@ -629,9 +666,25 @@ }); | ||
if (!(!response.status || response.status > 299)) { | ||
_context.next = 10; | ||
break; | ||
} | ||
_context.next = 8; | ||
return effects.put({ | ||
type: SIGNUP_ERROR, | ||
error: _.get(response, 'data') | ||
}); | ||
case 8: | ||
_context.next = 17; | ||
break; | ||
case 10: | ||
response['nextRoute'] = formData.nextRoute; | ||
// Persist token for future page loads | ||
_context.next = 8; | ||
_context.next = 13; | ||
return effects.select(getTokenName); | ||
case 8: | ||
case 13: | ||
tokenName = _context.sent; | ||
@@ -641,16 +694,16 @@ | ||
_context.next = 12; | ||
_context.next = 17; | ||
return effects.put(_extends({ type: SIGNUP_SUCCESS }, response)); | ||
case 12: | ||
_context.next = 18; | ||
case 17: | ||
_context.next = 23; | ||
break; | ||
case 14: | ||
_context.prev = 14; | ||
case 19: | ||
_context.prev = 19; | ||
_context.t0 = _context['catch'](1); | ||
_context.next = 18; | ||
_context.next = 23; | ||
return effects.put({ type: SIGNUP_ERROR, error: _.get(_context.t0, 'response.data', _context.t0) }); | ||
case 18: | ||
case 23: | ||
case 'end': | ||
@@ -660,3 +713,3 @@ return _context.stop(); | ||
} | ||
}, _marked$2, this, [[1, 14]]); | ||
}, _marked$2, this, [[1, 19]]); | ||
} | ||
@@ -678,9 +731,25 @@ | ||
if (!(!response.status || response.status > 299)) { | ||
_context2.next = 10; | ||
break; | ||
} | ||
_context2.next = 8; | ||
return effects.put({ | ||
type: LOGIN_ERROR, | ||
error: _.get(response, 'data') | ||
}); | ||
case 8: | ||
_context2.next = 17; | ||
break; | ||
case 10: | ||
response['nextRoute'] = formData.nextRoute; | ||
// Persist token for future page loads | ||
_context2.next = 8; | ||
_context2.next = 13; | ||
return effects.select(getTokenName); | ||
case 8: | ||
case 13: | ||
tokenName = _context2.sent; | ||
@@ -690,16 +759,16 @@ | ||
_context2.next = 12; | ||
_context2.next = 17; | ||
return effects.put(_extends({ type: LOGIN_SUCCESS }, response)); | ||
case 12: | ||
_context2.next = 18; | ||
case 17: | ||
_context2.next = 23; | ||
break; | ||
case 14: | ||
_context2.prev = 14; | ||
case 19: | ||
_context2.prev = 19; | ||
_context2.t0 = _context2['catch'](1); | ||
_context2.next = 18; | ||
_context2.next = 23; | ||
return effects.put({ type: LOGIN_ERROR, error: _.get(_context2.t0, 'response.data', _context2.t0) }); | ||
case 18: | ||
case 23: | ||
case 'end': | ||
@@ -709,3 +778,3 @@ return _context2.stop(); | ||
} | ||
}, _marked2$1, this, [[1, 14]]); | ||
}, _marked2$1, this, [[1, 19]]); | ||
} | ||
@@ -793,22 +862,28 @@ | ||
formData = action$$1.formData; | ||
_context4.prev = 1; | ||
_context4.next = 4; | ||
_context4.next = 3; | ||
return effects.call(api.patchUser, formData); | ||
case 4: | ||
case 3: | ||
response = _context4.sent; | ||
if (!(!response.status || response.status > 299)) { | ||
_context4.next = 9; | ||
break; | ||
} | ||
_context4.next = 7; | ||
return effects.put({ type: PATCH_USER_SUCCESS, response: response }); | ||
return effects.put({ | ||
type: PATCH_USER_ERROR, | ||
error: _.get(response, 'data') | ||
}); | ||
case 7: | ||
_context4.next = 13; | ||
_context4.next = 11; | ||
break; | ||
case 9: | ||
_context4.prev = 9; | ||
_context4.t0 = _context4['catch'](1); | ||
_context4.next = 13; | ||
return effects.put({ type: PATCH_USER_ERROR, error: _.get(_context4.t0, 'response.data', _context4.t0) }); | ||
_context4.next = 11; | ||
return effects.put({ type: PATCH_USER_SUCCESS, response: response }); | ||
case 13: | ||
case 11: | ||
case 'end': | ||
@@ -818,3 +893,3 @@ return _context4.stop(); | ||
} | ||
}, _marked4$1, this, [[1, 9]]); | ||
}, _marked4$1, this); | ||
} | ||
@@ -821,0 +896,0 @@ |
{ | ||
"name": "apax-react-core", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Contains core react functionality developed by Apax Software LLC", | ||
@@ -5,0 +5,0 @@ "author": "apaxsoftware", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116122
1679