mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
21 lines
537 B
TypeScript
21 lines
537 B
TypeScript
import { User, UsersState } from 'app/types';
|
|
import { Action, ActionTypes } from './actions';
|
|
|
|
export const initialState: UsersState = { users: [] as User[], searchQuery: '' };
|
|
|
|
export const usersReducer = (state = initialState, action: Action): UsersState => {
|
|
switch (action.type) {
|
|
case ActionTypes.LoadUsers:
|
|
return { ...state, users: action.payload };
|
|
|
|
case ActionTypes.SetUsersSearchQuery:
|
|
return { ...state, searchQuery: action.payload };
|
|
}
|
|
|
|
return state;
|
|
};
|
|
|
|
export default {
|
|
users: usersReducer,
|
|
};
|