apax-react-core
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -472,3 +472,6 @@ import axios from 'axios'; | ||
_marked2 = /*#__PURE__*/regeneratorRuntime.mark(apiPost), | ||
_marked3 = /*#__PURE__*/regeneratorRuntime.mark(apiGet); | ||
_marked3 = /*#__PURE__*/regeneratorRuntime.mark(apiGet), | ||
_marked4 = /*#__PURE__*/regeneratorRuntime.mark(apiPut), | ||
_marked5 = /*#__PURE__*/regeneratorRuntime.mark(apiPatch), | ||
_marked6 = /*#__PURE__*/regeneratorRuntime.mark(apiDelete); | ||
@@ -589,2 +592,104 @@ function getHeaders(authenticationRequired) { | ||
function apiPut(path, data) { | ||
var authenticationRequired = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
var headers, apiRoot, url; | ||
return regeneratorRuntime.wrap(function apiPut$(_context4) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
_context4.next = 2; | ||
return call(getHeaders, authenticationRequired); | ||
case 2: | ||
headers = _context4.sent; | ||
_context4.next = 5; | ||
return select(getApiRoot); | ||
case 5: | ||
apiRoot = _context4.sent; | ||
url = apiRoot + '/' + path; | ||
_context4.next = 9; | ||
return axios.put(url, data, headers).then(function (res) { | ||
return res.data; | ||
}); | ||
case 9: | ||
return _context4.abrupt('return', _context4.sent); | ||
case 10: | ||
case 'end': | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _marked4, this); | ||
} | ||
function apiPatch(path, data) { | ||
var authenticationRequired = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
var headers, apiRoot, url; | ||
return regeneratorRuntime.wrap(function apiPatch$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.next = 2; | ||
return call(getHeaders, authenticationRequired); | ||
case 2: | ||
headers = _context5.sent; | ||
_context5.next = 5; | ||
return select(getApiRoot); | ||
case 5: | ||
apiRoot = _context5.sent; | ||
url = apiRoot + '/' + path; | ||
_context5.next = 9; | ||
return axios.patch(url, data, headers).then(function (res) { | ||
return res.data; | ||
}); | ||
case 9: | ||
return _context5.abrupt('return', _context5.sent); | ||
case 10: | ||
case 'end': | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _marked5, this); | ||
} | ||
function apiDelete(path) { | ||
var authenticationRequired = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
var headers, apiRoot, url; | ||
return regeneratorRuntime.wrap(function apiDelete$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
_context6.next = 2; | ||
return call(getHeaders, authenticationRequired); | ||
case 2: | ||
headers = _context6.sent; | ||
_context6.next = 5; | ||
return select(getApiRoot); | ||
case 5: | ||
apiRoot = _context6.sent; | ||
url = apiRoot + '/' + path; | ||
_context6.next = 9; | ||
return axios.delete(url, headers).then(function (res) { | ||
return res.data; | ||
}); | ||
case 9: | ||
return _context6.abrupt('return', _context6.sent); | ||
case 10: | ||
case 'end': | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _marked6, this); | ||
} | ||
var api = { | ||
@@ -638,4 +743,4 @@ login: function login(data) { | ||
_marked3$1 = /*#__PURE__*/regeneratorRuntime.mark(loadUser), | ||
_marked4 = /*#__PURE__*/regeneratorRuntime.mark(loginFlow), | ||
_marked5 = /*#__PURE__*/regeneratorRuntime.mark(_callee); | ||
_marked4$1 = /*#__PURE__*/regeneratorRuntime.mark(loginFlow), | ||
_marked5$1 = /*#__PURE__*/regeneratorRuntime.mark(_callee); | ||
@@ -868,3 +973,3 @@ function doSignup(action$$1) { | ||
} | ||
}, _marked4, this); | ||
}, _marked4$1, this); | ||
} | ||
@@ -885,6 +990,6 @@ | ||
} | ||
}, _marked5, this); | ||
}, _marked5$1, this); | ||
} | ||
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 }; | ||
export { account as accountReducer, env as envReducer, _callee as accountSagas, api, apiPost, apiGet, apiPut, apiPatch, apiDelete, 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 |
@@ -478,3 +478,6 @@ 'use strict'; | ||
_marked2 = /*#__PURE__*/regeneratorRuntime.mark(apiPost), | ||
_marked3 = /*#__PURE__*/regeneratorRuntime.mark(apiGet); | ||
_marked3 = /*#__PURE__*/regeneratorRuntime.mark(apiGet), | ||
_marked4 = /*#__PURE__*/regeneratorRuntime.mark(apiPut), | ||
_marked5 = /*#__PURE__*/regeneratorRuntime.mark(apiPatch), | ||
_marked6 = /*#__PURE__*/regeneratorRuntime.mark(apiDelete); | ||
@@ -595,2 +598,104 @@ function getHeaders(authenticationRequired) { | ||
function apiPut(path, data) { | ||
var authenticationRequired = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
var headers, apiRoot, url; | ||
return regeneratorRuntime.wrap(function apiPut$(_context4) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
_context4.next = 2; | ||
return effects.call(getHeaders, authenticationRequired); | ||
case 2: | ||
headers = _context4.sent; | ||
_context4.next = 5; | ||
return effects.select(getApiRoot); | ||
case 5: | ||
apiRoot = _context4.sent; | ||
url = apiRoot + '/' + path; | ||
_context4.next = 9; | ||
return axios.put(url, data, headers).then(function (res) { | ||
return res.data; | ||
}); | ||
case 9: | ||
return _context4.abrupt('return', _context4.sent); | ||
case 10: | ||
case 'end': | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _marked4, this); | ||
} | ||
function apiPatch(path, data) { | ||
var authenticationRequired = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
var headers, apiRoot, url; | ||
return regeneratorRuntime.wrap(function apiPatch$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.next = 2; | ||
return effects.call(getHeaders, authenticationRequired); | ||
case 2: | ||
headers = _context5.sent; | ||
_context5.next = 5; | ||
return effects.select(getApiRoot); | ||
case 5: | ||
apiRoot = _context5.sent; | ||
url = apiRoot + '/' + path; | ||
_context5.next = 9; | ||
return axios.patch(url, data, headers).then(function (res) { | ||
return res.data; | ||
}); | ||
case 9: | ||
return _context5.abrupt('return', _context5.sent); | ||
case 10: | ||
case 'end': | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _marked5, this); | ||
} | ||
function apiDelete(path) { | ||
var authenticationRequired = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
var headers, apiRoot, url; | ||
return regeneratorRuntime.wrap(function apiDelete$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
_context6.next = 2; | ||
return effects.call(getHeaders, authenticationRequired); | ||
case 2: | ||
headers = _context6.sent; | ||
_context6.next = 5; | ||
return effects.select(getApiRoot); | ||
case 5: | ||
apiRoot = _context6.sent; | ||
url = apiRoot + '/' + path; | ||
_context6.next = 9; | ||
return axios.delete(url, headers).then(function (res) { | ||
return res.data; | ||
}); | ||
case 9: | ||
return _context6.abrupt('return', _context6.sent); | ||
case 10: | ||
case 'end': | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _marked6, this); | ||
} | ||
var api = { | ||
@@ -644,4 +749,4 @@ login: function login(data) { | ||
_marked3$1 = /*#__PURE__*/regeneratorRuntime.mark(loadUser), | ||
_marked4 = /*#__PURE__*/regeneratorRuntime.mark(loginFlow), | ||
_marked5 = /*#__PURE__*/regeneratorRuntime.mark(_callee); | ||
_marked4$1 = /*#__PURE__*/regeneratorRuntime.mark(loginFlow), | ||
_marked5$1 = /*#__PURE__*/regeneratorRuntime.mark(_callee); | ||
@@ -874,3 +979,3 @@ function doSignup(action$$1) { | ||
} | ||
}, _marked4, this); | ||
}, _marked4$1, this); | ||
} | ||
@@ -891,3 +996,3 @@ | ||
} | ||
}, _marked5, this); | ||
}, _marked5$1, this); | ||
} | ||
@@ -899,2 +1004,7 @@ | ||
exports.api = api; | ||
exports.apiPost = apiPost; | ||
exports.apiGet = apiGet; | ||
exports.apiPut = apiPut; | ||
exports.apiPatch = apiPatch; | ||
exports.apiDelete = apiDelete; | ||
exports.getUser = getUser; | ||
@@ -901,0 +1011,0 @@ exports.getToken = getToken; |
{ | ||
"name": "apax-react-core", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Contains core react functionality developed by Apax Software LLC", | ||
@@ -5,0 +5,0 @@ "author": "apaxsoftware", |
@@ -117,4 +117,2 @@ # apax-react-core | ||
} | ||
### Login User | ||
@@ -144,5 +142,28 @@ | ||
} | ||
### API | ||
The following API methods are available: | ||
`apiGet(path, data, authenticationRequired = true)` | ||
`apiPost(path, data, authenticationRequired = true)` | ||
`apiPut(path, data, authenticationRequired = true)` | ||
`apiPatch(path, data, authenticationRequired = true)` | ||
`apiDelete(path, authenticationRequired = true)` | ||
#### Usage | ||
``` | ||
import { | ||
apiGet | ||
} from 'apax-react-core'; | ||
... | ||
const response = yield apiGet('api/mypath/'); | ||
``` | ||
## License | ||
@@ -149,0 +170,0 @@ |
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
126305
1710
190