29 lines
671 B
TypeScript
29 lines
671 B
TypeScript
import { MessageBarType } from '@fluentui/react';
|
|
import { INotification } from '../models/INotification';
|
|
import { IAppContextState } from './IAppContextState';
|
|
|
|
export type Action = { type: 'SET_NOTIFICATION'; payload: INotification };
|
|
|
|
export const initialState: IAppContextState = {
|
|
notification: {
|
|
messageBarType: MessageBarType.info,
|
|
message: 'Blah blah blah',
|
|
isMultiline: false,
|
|
isVisible: true
|
|
}
|
|
};
|
|
|
|
export const reducer = (
|
|
state: IAppContextState,
|
|
action: Action
|
|
): IAppContextState => {
|
|
switch (action.type) {
|
|
case 'SET_NOTIFICATION': {
|
|
return {
|
|
...state,
|
|
notification: action.payload
|
|
};
|
|
}
|
|
}
|
|
};
|