mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
24 lines
619 B
TypeScript
24 lines
619 B
TypeScript
import { ApiKeysState } from 'app/types';
|
|
import { Action, ActionTypes } from './actions';
|
|
|
|
export const initialApiKeysState: ApiKeysState = {
|
|
keys: [],
|
|
searchQuery: '',
|
|
hasFetched: false,
|
|
includeExpired: false,
|
|
};
|
|
|
|
export const apiKeysReducer = (state = initialApiKeysState, action: Action): ApiKeysState => {
|
|
switch (action.type) {
|
|
case ActionTypes.LoadApiKeys:
|
|
return { ...state, hasFetched: true, keys: action.payload };
|
|
case ActionTypes.SetApiKeysSearchQuery:
|
|
return { ...state, searchQuery: action.payload };
|
|
}
|
|
return state;
|
|
};
|
|
|
|
export default {
|
|
apiKeys: apiKeysReducer,
|
|
};
|