Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (dispatch) => {
dispatch({
type: key + '_QUERY_START',
pathOrId: pathOrId,
message:
IntlService.instance.searchAndReplace(messageStart) ||
IntlService.instance.translate({
key: 'providers.fetch_started',
default: 'Fetch Started',
case: 'words',
}) + '...',
})
// Switch methods used based on path until everything is converted to use the the new endpoints
if (pathOrId.indexOf(ConfGlobal.apiURL) !== -1) {
return DirectoryOperations.getDocumentsViaAPI(pathOrId)
.then((response) => {
dispatch({
type: key + '_QUERY_SUCCESS',
message: _messageSuccess,
response: response,
pathOrId: pathOrId,
})
})
.catch((error) => {
dispatch({
type: key + '_QUERY_ERROR',
message: _messageError || IntlService.instance.searchAndReplace(error),
pathOrId: pathOrId,
})
})
return (dispatch) => {
dispatch({
type: key + '_QUERY_START',
pathOrId: pathOrId,
message:
_messageStart ||
IntlService.instance.translate({
key: 'providers.fetch_started',
default: 'Fetch Started',
case: 'words',
}) + '...',
})
// Switch methods used based on path until everything is converted to use the the new endpoints
if (pathOrId.indexOf(ConfGlobal.apiURL) !== -1) {
return DirectoryOperations.getDocumentsViaAPI(pathOrId)
.then((response) => {
dispatch({
type: key + '_QUERY_SUCCESS',
message: _messageSuccess,
response: response,
pathOrId: pathOrId,
})
})
.catch((error) => {
dispatch({
type: key + '_QUERY_ERROR',
message: _messageError || IntlService.instance.searchAndReplace(error),
pathOrId: pathOrId,
})
})
return (dispatch) => {
dispatch({
type: key + '_QUERY_START',
pathOrId: pathOrId,
message:
messageStart ||
IntlService.instance.translate({
key: 'providers.fetch_started',
default: 'Fetch Started',
case: 'words',
}) + '...',
})
// Switch methods used based on path until everything is converted to use the the new endpoints
if (pathOrId.indexOf(ConfGlobal.apiURL) !== -1) {
return DirectoryOperations.getDocumentsViaAPI(pathOrId)
.then((response) => {
dispatch({
type: key + '_QUERY_SUCCESS',
message: messageSuccess,
response: response,
pathOrId: pathOrId,
})
})
.catch((error) => {
dispatch({
type: key + '_QUERY_ERROR',
message: messageError || IntlService.instance.searchAndReplace(error),
pathOrId: pathOrId,
})
})