grafana/public/app/features/manage-dashboards/state/reducers.ts

27 lines
542 B
TypeScript
Raw Normal View History

2018-09-10 14:49:04 -05:00
import { FolderState } from 'app/types';
import { Action, ActionTypes } from './actions';
2018-09-11 03:36:55 -05:00
export const inititalState: FolderState = {
uid: 'loading',
id: -1,
title: 'loading',
canSave: false,
hasChanged: false,
};
2018-09-10 14:49:04 -05:00
export const folderReducer = (state = inititalState, action: Action): FolderState => {
switch (action.type) {
case ActionTypes.LoadFolder:
return {
...action.payload,
canSave: false,
hasChanged: false,
};
}
return state;
};
export default {
folder: folderReducer,
};