mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 11:03:50 +00:00
Added more behavior to servers list
This commit is contained in:
22
src/servers/reducers/server.js
Normal file
22
src/servers/reducers/server.js
Normal 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(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user