Added more behavior to servers list

This commit is contained in:
Alejandro Celaya
2018-06-14 20:11:41 +02:00
parent 9ac0811200
commit e4356720d7
7 changed files with 91 additions and 32 deletions

View File

@@ -0,0 +1,22 @@
import ServersService from '../services';
const FETCH_SERVERS = 'shlink/FETCH_SERVERS';
const CREATE_SERVER = 'shlink/CREATE_SERVER';
export default function serversReducer(state = {}, action) {
switch (action.type) {
case FETCH_SERVERS:
return action.servers;
case CREATE_SERVER:
return [ ...state, action.server ];
}
return state;
}
export const listServers = () => {
return {
type: FETCH_SERVERS,
servers: ServersService.listServers(),
};
};