mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-07-28 06:31:53 +00:00
Implemented importing servers from CSV file
This commit is contained in:
@@ -2,17 +2,11 @@ import ServersService from '../services/ServersService';
|
||||
import { curry } from 'ramda';
|
||||
|
||||
export const FETCH_SERVERS = 'shlink/servers/FETCH_SERVERS';
|
||||
export const CREATE_SERVER = 'shlink/servers/CREATE_SERVER';
|
||||
export const DELETE_SERVER = 'shlink/servers/DELETE_SERVER';
|
||||
|
||||
export default function reducer(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case FETCH_SERVERS:
|
||||
case DELETE_SERVER:
|
||||
return action.servers;
|
||||
case CREATE_SERVER:
|
||||
const server = action.server;
|
||||
return { ...state, [server.id]: server };
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
@@ -35,3 +29,9 @@ export const _deleteServer = (ServersService, server) => {
|
||||
return _listServers(ServersService);
|
||||
};
|
||||
export const deleteServer = curry(_deleteServer)(ServersService);
|
||||
|
||||
export const _createServers = (ServersService, servers) => {
|
||||
ServersService.createServers(servers);
|
||||
return _listServers(ServersService);
|
||||
};
|
||||
export const createServers = curry(_createServers)(ServersService);
|
||||
|
||||
Reference in New Issue
Block a user