Fetch redis info from RedisInfoView

This commit is contained in:
Ken Hibino
2021-01-03 08:07:19 -08:00
parent 5a83172784
commit 4951d2f571
5 changed files with 253 additions and 2 deletions

View File

@@ -0,0 +1,45 @@
import {
GET_REDIS_INFO_BEGIN,
GET_REDIS_INFO_ERROR,
GET_REDIS_INFO_SUCCESS,
RedisInfoActionTypes,
} from "../actions/redisInfoActions";
import { RedisInfo } from "../api";
interface RedisInfoState {
loading: boolean;
data: RedisInfo | null;
}
const initialState: RedisInfoState = {
loading: false,
data: null,
};
export default function redisInfoReducer(
state = initialState,
action: RedisInfoActionTypes
): RedisInfoState {
switch (action.type) {
case GET_REDIS_INFO_BEGIN:
return {
...state,
loading: true,
};
case GET_REDIS_INFO_ERROR:
return {
...state,
loading: false,
};
case GET_REDIS_INFO_SUCCESS:
return {
loading: false,
data: action.payload,
};
default:
return state;
}
}