mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-20 13:36:20 +00:00
Extracted short-url related services to its own service provider
This commit is contained in:
@@ -23,8 +23,6 @@ export const resetSelectedServer = () => ({ type: RESET_SELECTED_SERVER });
|
||||
export const selectServer = (serversService) => (serverId) => (dispatch) => {
|
||||
dispatch(resetShortUrlParams());
|
||||
|
||||
console.log('Setting server');
|
||||
|
||||
const selectedServer = serversService.findServerById(serverId);
|
||||
|
||||
dispatch({
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { dissoc, head, keys, values } from 'ramda';
|
||||
import csvjson from 'csvjson';
|
||||
import serversService from './ServersService';
|
||||
|
||||
const saveCsv = (window, csv) => {
|
||||
const { navigator, document } = window;
|
||||
@@ -26,7 +24,7 @@ const saveCsv = (window, csv) => {
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
|
||||
export class ServersExporter {
|
||||
export default class ServersExporter {
|
||||
constructor(serversService, window, csvjson) {
|
||||
this.serversService = serversService;
|
||||
this.window = window;
|
||||
@@ -49,7 +47,3 @@ export class ServersExporter {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const serverExporter = new ServersExporter(serversService, global.window, csvjson);
|
||||
|
||||
export default serverExporter;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import csvjson from 'csvjson';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export const serversImporterType = PropTypes.shape({
|
||||
importServersFromFile: PropTypes.func,
|
||||
});
|
||||
|
||||
export class ServersImporter {
|
||||
export default class ServersImporter {
|
||||
constructor(csvjson) {
|
||||
this.csvjson = csvjson;
|
||||
}
|
||||
@@ -28,7 +27,3 @@ export class ServersImporter {
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const serversImporter = new ServersImporter(csvjson);
|
||||
|
||||
export default serversImporter;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { assoc, dissoc, reduce } from 'ramda';
|
||||
import storage from '../../utils/Storage';
|
||||
|
||||
const SERVERS_STORAGE_KEY = 'servers';
|
||||
|
||||
export class ServersService {
|
||||
export default class ServersService {
|
||||
constructor(storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
@@ -30,7 +29,3 @@ export class ServersService {
|
||||
dissoc(server.id, this.listServers())
|
||||
);
|
||||
}
|
||||
|
||||
const serversService = new ServersService(storage);
|
||||
|
||||
export default serversService;
|
||||
|
||||
@@ -6,9 +6,9 @@ import DeleteServerButton from '../DeleteServerButton';
|
||||
import ImportServersBtn from '../helpers/ImportServersBtn';
|
||||
import { resetSelectedServer, selectServer } from '../reducers/selectedServer';
|
||||
import { createServer, createServers, deleteServer, listServers } from '../reducers/server';
|
||||
import { ServersImporter } from './ServersImporter';
|
||||
import { ServersService } from './ServersService';
|
||||
import { ServersExporter } from './ServersExporter';
|
||||
import ServersImporter from './ServersImporter';
|
||||
import ServersService from './ServersService';
|
||||
import ServersExporter from './ServersExporter';
|
||||
|
||||
const provideServices = (bottle, connect, withRouter) => {
|
||||
// Components
|
||||
|
||||
Reference in New Issue
Block a user