mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-09-17 04:04:28 +08:00
Fetch redis info from RedisInfoView
This commit is contained in:
45
ui/src/reducers/redisInfoReducer.ts
Normal file
45
ui/src/reducers/redisInfoReducer.ts
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user