Moved all server-related services to its own service provider

This commit is contained in:
Alejandro Celaya
2018-12-18 19:45:09 +01:00
parent 566322a8c5
commit cf1239cf6e
7 changed files with 88 additions and 84 deletions

View File

@@ -1,6 +1,5 @@
import { assoc, assocPath, reject } from 'ramda';
import PropTypes from 'prop-types';
import { buildShlinkApiClientWithAxios as buildShlinkApiClient } from '../../api/ShlinkApiClientBuilder';
import { SHORT_URL_TAGS_EDITED } from './shortUrlTags';
import { SHORT_URL_DELETED } from './shortUrlDeletion';
@@ -55,10 +54,10 @@ export default function reducer(state = initialState, action) {
}
}
export const _listShortUrls = (buildShlinkApiClient, params = {}) => async (dispatch, getState) => {
export const listShortUrls = (buildShlinkApiClient) => (params = {}) => async (dispatch, getState) => {
dispatch({ type: LIST_SHORT_URLS_START });
const { selectedServer } = getState();
const { selectedServer = {} } = getState();
const shlinkApiClient = buildShlinkApiClient(selectedServer);
try {
@@ -69,5 +68,3 @@ export const _listShortUrls = (buildShlinkApiClient, params = {}) => async (disp
dispatch({ type: LIST_SHORT_URLS_ERROR, params });
}
};
export const listShortUrls = (params = {}) => _listShortUrls(buildShlinkApiClient, params);