apax-react-core
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -16,2 +16,3 @@ import axios from 'axios'; | ||
var LOGOUT = 'LOGOUT'; | ||
var CLEAR_ERRORS = 'CLEAR_ERRORS'; | ||
@@ -25,7 +26,6 @@ var setUserToken = function setUserToken(token) { | ||
var login = function login(formData, history) { | ||
var login = function login(formData) { | ||
return { | ||
type: LOGIN, | ||
formData: formData, | ||
history: history | ||
formData: formData | ||
}; | ||
@@ -40,7 +40,6 @@ }; | ||
var signup = function signup(formData, history) { | ||
var signup = function signup(formData) { | ||
return { | ||
type: SIGNUP, | ||
formData: formData, | ||
history: history | ||
formData: formData | ||
}; | ||
@@ -345,2 +344,3 @@ }; | ||
userLoading: false, | ||
loadUserError: null, | ||
loginPending: false, | ||
@@ -411,2 +411,8 @@ loginError: null, | ||
}); | ||
case CLEAR_ERRORS: | ||
return _extends({}, state, { | ||
signupError: null, | ||
loginError: null, | ||
loadUserError: null | ||
}); | ||
default: | ||
@@ -615,18 +621,6 @@ return state; | ||
case 0: | ||
_context.t0 = all; | ||
_context.next = 3; | ||
return call.apply(undefined, _args); | ||
_context.next = 2; | ||
return all([call.apply(undefined, _args), call(delay, 500)]); | ||
case 3: | ||
_context.t1 = _context.sent; | ||
_context.next = 6; | ||
return call(delay, 500); | ||
case 6: | ||
_context.t2 = _context.sent; | ||
_context.t3 = [_context.t1, _context.t2]; | ||
_context.next = 10; | ||
return (0, _context.t0)(_context.t3); | ||
case 10: | ||
case 2: | ||
_ref = _context.sent; | ||
@@ -637,3 +631,3 @@ _ref2 = slicedToArray(_ref, 1); | ||
case 14: | ||
case 6: | ||
case 'end': | ||
@@ -653,3 +647,3 @@ return _context.stop(); | ||
function doSignup(action$$1) { | ||
var formData, history, response, tokenName; | ||
var formData, response, tokenName; | ||
return regeneratorRuntime.wrap(function doSignup$(_context) { | ||
@@ -659,3 +653,3 @@ while (1) { | ||
case 0: | ||
formData = action$$1.formData, history = action$$1.history; | ||
formData = action$$1.formData; | ||
_context.prev = 1; | ||
@@ -675,18 +669,16 @@ _context.next = 4; | ||
// Redirect user to home | ||
history.replace('/'); | ||
_context.next = 12; | ||
_context.next = 11; | ||
return put(_extends({ type: SIGNUP_SUCCESS }, response)); | ||
case 12: | ||
_context.next = 18; | ||
case 11: | ||
_context.next = 17; | ||
break; | ||
case 14: | ||
_context.prev = 14; | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context['catch'](1); | ||
_context.next = 18; | ||
_context.next = 17; | ||
return put({ type: SIGNUP_ERROR, error: _context.t0.response.data }); | ||
case 18: | ||
case 17: | ||
case 'end': | ||
@@ -696,7 +688,7 @@ return _context.stop(); | ||
} | ||
}, _marked$2, this, [[1, 14]]); | ||
}, _marked$2, this, [[1, 13]]); | ||
} | ||
function doLogin(action$$1) { | ||
var formData, history, response, tokenName; | ||
var formData, response, tokenName; | ||
return regeneratorRuntime.wrap(function doLogin$(_context2) { | ||
@@ -706,3 +698,3 @@ while (1) { | ||
case 0: | ||
formData = action$$1.formData, history = action$$1.history; | ||
formData = action$$1.formData; | ||
_context2.prev = 1; | ||
@@ -722,18 +714,16 @@ _context2.next = 4; | ||
// Redirect user to home | ||
history.replace('/'); | ||
_context2.next = 12; | ||
_context2.next = 11; | ||
return put(_extends({ type: LOGIN_SUCCESS }, response)); | ||
case 12: | ||
_context2.next = 18; | ||
case 11: | ||
_context2.next = 17; | ||
break; | ||
case 14: | ||
_context2.prev = 14; | ||
case 13: | ||
_context2.prev = 13; | ||
_context2.t0 = _context2['catch'](1); | ||
_context2.next = 18; | ||
_context2.next = 17; | ||
return put({ type: LOGIN_ERROR, error: _context2.t0.response.data }); | ||
case 18: | ||
case 17: | ||
case 'end': | ||
@@ -743,3 +733,3 @@ return _context2.stop(); | ||
} | ||
}, _marked2$1, this, [[1, 14]]); | ||
}, _marked2$1, this, [[1, 13]]); | ||
} | ||
@@ -908,3 +898,3 @@ | ||
export { account as accountReducer, env as envReducer, _callee as accountSagas, api, getUser, getToken, getApiRoot, getTokenName, SET_USER_TOKEN, LOAD_USER, LOAD_USER_SUCCESS, LOAD_USER_ERROR, LOGIN, SIGNUP, LOGIN_SUCCESS, SIGNUP_SUCCESS, SIGNUP_ERROR, LOGIN_ERROR, LOGOUT, setUserToken, login, logout, signup, SET_ENV, setEnv }; | ||
export { account as accountReducer, env as envReducer, _callee as accountSagas, api, getUser, getToken, getApiRoot, getTokenName, SET_USER_TOKEN, LOAD_USER, LOAD_USER_SUCCESS, LOAD_USER_ERROR, LOGIN, SIGNUP, LOGIN_SUCCESS, SIGNUP_SUCCESS, SIGNUP_ERROR, LOGIN_ERROR, LOGOUT, CLEAR_ERRORS, setUserToken, login, logout, signup, SET_ENV, setEnv }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -22,2 +22,3 @@ 'use strict'; | ||
var LOGOUT = 'LOGOUT'; | ||
var CLEAR_ERRORS = 'CLEAR_ERRORS'; | ||
@@ -31,7 +32,6 @@ var setUserToken = function setUserToken(token) { | ||
var login = function login(formData, history) { | ||
var login = function login(formData) { | ||
return { | ||
type: LOGIN, | ||
formData: formData, | ||
history: history | ||
formData: formData | ||
}; | ||
@@ -46,7 +46,6 @@ }; | ||
var signup = function signup(formData, history) { | ||
var signup = function signup(formData) { | ||
return { | ||
type: SIGNUP, | ||
formData: formData, | ||
history: history | ||
formData: formData | ||
}; | ||
@@ -351,2 +350,3 @@ }; | ||
userLoading: false, | ||
loadUserError: null, | ||
loginPending: false, | ||
@@ -417,2 +417,8 @@ loginError: null, | ||
}); | ||
case CLEAR_ERRORS: | ||
return _extends({}, state, { | ||
signupError: null, | ||
loginError: null, | ||
loadUserError: null | ||
}); | ||
default: | ||
@@ -621,18 +627,6 @@ return state; | ||
case 0: | ||
_context.t0 = effects.all; | ||
_context.next = 3; | ||
return effects.call.apply(undefined, _args); | ||
_context.next = 2; | ||
return effects.all([effects.call.apply(undefined, _args), effects.call(delay, 500)]); | ||
case 3: | ||
_context.t1 = _context.sent; | ||
_context.next = 6; | ||
return effects.call(delay, 500); | ||
case 6: | ||
_context.t2 = _context.sent; | ||
_context.t3 = [_context.t1, _context.t2]; | ||
_context.next = 10; | ||
return (0, _context.t0)(_context.t3); | ||
case 10: | ||
case 2: | ||
_ref = _context.sent; | ||
@@ -643,3 +637,3 @@ _ref2 = slicedToArray(_ref, 1); | ||
case 14: | ||
case 6: | ||
case 'end': | ||
@@ -659,3 +653,3 @@ return _context.stop(); | ||
function doSignup(action$$1) { | ||
var formData, history, response, tokenName; | ||
var formData, response, tokenName; | ||
return regeneratorRuntime.wrap(function doSignup$(_context) { | ||
@@ -665,3 +659,3 @@ while (1) { | ||
case 0: | ||
formData = action$$1.formData, history = action$$1.history; | ||
formData = action$$1.formData; | ||
_context.prev = 1; | ||
@@ -681,18 +675,16 @@ _context.next = 4; | ||
// Redirect user to home | ||
history.replace('/'); | ||
_context.next = 12; | ||
_context.next = 11; | ||
return effects.put(_extends({ type: SIGNUP_SUCCESS }, response)); | ||
case 12: | ||
_context.next = 18; | ||
case 11: | ||
_context.next = 17; | ||
break; | ||
case 14: | ||
_context.prev = 14; | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context['catch'](1); | ||
_context.next = 18; | ||
_context.next = 17; | ||
return effects.put({ type: SIGNUP_ERROR, error: _context.t0.response.data }); | ||
case 18: | ||
case 17: | ||
case 'end': | ||
@@ -702,7 +694,7 @@ return _context.stop(); | ||
} | ||
}, _marked$2, this, [[1, 14]]); | ||
}, _marked$2, this, [[1, 13]]); | ||
} | ||
function doLogin(action$$1) { | ||
var formData, history, response, tokenName; | ||
var formData, response, tokenName; | ||
return regeneratorRuntime.wrap(function doLogin$(_context2) { | ||
@@ -712,3 +704,3 @@ while (1) { | ||
case 0: | ||
formData = action$$1.formData, history = action$$1.history; | ||
formData = action$$1.formData; | ||
_context2.prev = 1; | ||
@@ -728,18 +720,16 @@ _context2.next = 4; | ||
// Redirect user to home | ||
history.replace('/'); | ||
_context2.next = 12; | ||
_context2.next = 11; | ||
return effects.put(_extends({ type: LOGIN_SUCCESS }, response)); | ||
case 12: | ||
_context2.next = 18; | ||
case 11: | ||
_context2.next = 17; | ||
break; | ||
case 14: | ||
_context2.prev = 14; | ||
case 13: | ||
_context2.prev = 13; | ||
_context2.t0 = _context2['catch'](1); | ||
_context2.next = 18; | ||
_context2.next = 17; | ||
return effects.put({ type: LOGIN_ERROR, error: _context2.t0.response.data }); | ||
case 18: | ||
case 17: | ||
case 'end': | ||
@@ -749,3 +739,3 @@ return _context2.stop(); | ||
} | ||
}, _marked2$1, this, [[1, 14]]); | ||
}, _marked2$1, this, [[1, 13]]); | ||
} | ||
@@ -933,2 +923,3 @@ | ||
exports.LOGOUT = LOGOUT; | ||
exports.CLEAR_ERRORS = CLEAR_ERRORS; | ||
exports.setUserToken = setUserToken; | ||
@@ -935,0 +926,0 @@ exports.login = login; |
{ | ||
"name": "apax-react-core", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Contains core react functionality developed by Apax Software LLC", | ||
@@ -12,4 +12,4 @@ "author": "apaxsoftware", | ||
"engines": { | ||
"node": ">=8", | ||
"npm": ">=5" | ||
"node": ">=10", | ||
"npm": ">=6" | ||
}, | ||
@@ -19,2 +19,3 @@ "scripts": { | ||
"test:watch": "react-scripts test --env=jsdom", | ||
"test:coverage": "yarn test --coverage", | ||
"build": "rollup -c", | ||
@@ -82,10 +83,14 @@ "start": "rollup -c -w", | ||
"collectCoverageFrom": [ | ||
"src/redux/**/*.js" | ||
"src/sagas/**/*.js", | ||
"!src/**/index.js" | ||
], | ||
"coverageThreshold": { | ||
"global": { | ||
"lines": 100 | ||
"lines": 90 | ||
} | ||
} | ||
}, | ||
"resolutions": { | ||
"handlebars": "4.5.0" | ||
}, | ||
"files": [ | ||
@@ -92,0 +97,0 @@ "dist" |
# apax-react-core | ||
[![Build Status](https://travis-ci.org/apaxsoftware/apax-react-core.svg?branch=master)](https://travis-ci.org/apaxsoftware/apax-react-core) | ||
@@ -3,0 +4,0 @@ Contains core react functionality developed by Apax Software LLC |
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
8
169
115748
1525