mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-31 01:26:16 +00:00
More components migrated for dependency injection
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
import { assoc, dissoc, pick, pipe } from 'ramda';
|
||||
import { assoc, dissoc, pipe } from 'ramda';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import PropTypes from 'prop-types';
|
||||
import { stateFlagTimeout } from '../utils/utils';
|
||||
import { resetSelectedServer } from './reducers/selectedServer';
|
||||
import { createServer } from './reducers/server';
|
||||
import './CreateServer.scss';
|
||||
import ImportServersBtn from './helpers/ImportServersBtn';
|
||||
|
||||
const SHOW_IMPORT_MSG_TIME = 4000;
|
||||
|
||||
export class CreateServerComponent extends React.Component {
|
||||
export default class CreateServer extends React.Component {
|
||||
static propTypes = {
|
||||
createServer: PropTypes.func,
|
||||
history: PropTypes.shape({
|
||||
@@ -92,10 +89,3 @@ export class CreateServerComponent extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const CreateServer = connect(
|
||||
pick([ 'selectedServer' ]),
|
||||
{ createServer, resetSelectedServer }
|
||||
)(CreateServerComponent);
|
||||
|
||||
export default CreateServer;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { curry } from 'ramda';
|
||||
import shlinkApiClient from '../../api/ShlinkApiClient';
|
||||
import serversService from '../../servers/services/ServersService';
|
||||
import { resetShortUrlParams } from '../../short-urls/reducers/shortUrlsListParams';
|
||||
@@ -23,7 +22,7 @@ export default function reducer(state = defaultState, action) {
|
||||
|
||||
export const resetSelectedServer = () => ({ type: RESET_SELECTED_SERVER });
|
||||
|
||||
export const _selectServer = (shlinkApiClient, serversService, serverId) => (dispatch) => {
|
||||
export const _selectServer = (shlinkApiClient, serversService) => (serverId) => (dispatch) => {
|
||||
dispatch(resetShortUrlParams());
|
||||
|
||||
const selectedServer = serversService.findServerById(serverId);
|
||||
@@ -36,4 +35,4 @@ export const _selectServer = (shlinkApiClient, serversService, serverId) => (dis
|
||||
});
|
||||
};
|
||||
|
||||
export const selectServer = curry(_selectServer)(shlinkApiClient, serversService);
|
||||
export const selectServer = _selectServer(shlinkApiClient, serversService);
|
||||
|
||||
Reference in New Issue
Block a user