mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-08-03 01:21:54 +00:00
Removed duplicated code when building ShlinkApiClient
This commit is contained in:
@@ -32,11 +32,10 @@ export default handleActions({
|
||||
export const createShortUrl = (buildShlinkApiClient) => (data) => async (dispatch, getState) => {
|
||||
dispatch({ type: CREATE_SHORT_URL_START });
|
||||
|
||||
const { selectedServer } = getState();
|
||||
const shlinkApiClient = buildShlinkApiClient(selectedServer);
|
||||
const { createShortUrl } = await buildShlinkApiClient(getState);
|
||||
|
||||
try {
|
||||
const result = await shlinkApiClient.createShortUrl(data);
|
||||
const result = await createShortUrl(data);
|
||||
|
||||
dispatch({ type: CREATE_SHORT_URL, result });
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user