reducers.ts 602 B

12345678910111213141516171819202122232425262728
  1. import { DataSourceCacheState } from '../../types';
  2. import { Action, ActionTypes } from './actions';
  3. const initialState: DataSourceCacheState = {
  4. enabled: false,
  5. dataSourceID: 0,
  6. dataSourceUID: '',
  7. ttlQueriesMs: 0,
  8. ttlResourcesMs: 0,
  9. defaultTTLMs: 0,
  10. useDefaultTTL: true,
  11. };
  12. export const dataSourceCacheReducer = (state = initialState, action: Action): DataSourceCacheState => {
  13. switch (action.type) {
  14. case ActionTypes.LoadDataSourceCache:
  15. return {
  16. ...action.payload,
  17. };
  18. }
  19. return state;
  20. };
  21. export default {
  22. dataSourceCache: dataSourceCacheReducer,
  23. };