Initial commit AB#12
This commit is contained in:
28
app/src/context/reducer.ts
Normal file
28
app/src/context/reducer.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user