[ ADD ] react configuration
This commit is contained in:
15
react/src/store/Snackbar/SnackbarAction.js
Normal file
15
react/src/store/Snackbar/SnackbarAction.js
Normal file
@ -0,0 +1,15 @@
|
||||
import * as types from './SnackbarTypes';
|
||||
|
||||
export const showSnackbarAction = (message , snacknarType) => {
|
||||
return {
|
||||
type: types.SHOW_SNACKBAR,
|
||||
message ,
|
||||
snacknarType
|
||||
};
|
||||
};
|
||||
|
||||
export const hideSnackbarAction = () => {
|
||||
return {
|
||||
type: types.HIDE_SNACKBAR
|
||||
};
|
||||
};
|
21
react/src/store/Snackbar/SnackbarReducer.js
Normal file
21
react/src/store/Snackbar/SnackbarReducer.js
Normal file
@ -0,0 +1,21 @@
|
||||
import * as types from "./SnackbarTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case types.SHOW_SNACKBAR:
|
||||
return {
|
||||
...state,
|
||||
isOpen: true,
|
||||
message: action.message,
|
||||
type: action.snacknarType
|
||||
};
|
||||
case types.HIDE_SNACKBAR:
|
||||
return {
|
||||
...state,
|
||||
isOpen: false
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
2
react/src/store/Snackbar/SnackbarTypes.js
Normal file
2
react/src/store/Snackbar/SnackbarTypes.js
Normal file
@ -0,0 +1,2 @@
|
||||
export const SHOW_SNACKBAR = 'SHOW_SNACKBAR';
|
||||
export const HIDE_SNACKBAR = 'HIDE_SNACKBAR';
|
Reference in New Issue
Block a user