Skip to content
Snippets Groups Projects
Commit 3330ed75 authored by Evelyn Eastmond's avatar Evelyn Eastmond
Browse files

Passing custom alert messages.

parent fa596645
Branches
Tags
No related merge requests found
......@@ -139,7 +139,9 @@ const vmListenerHOC = function (WrappedComponent) {
onProjectRunStop: () => dispatch(setRunningState(false)),
onTurboModeOn: () => dispatch(setTurboState(true)),
onTurboModeOff: () => dispatch(setTurboState(false)),
onShowAlert: () => dispatch(showAlert())
onShowAlert: data => {
dispatch(showAlert(data.message));
}
});
return connect(
mapStateToProps,
......
......@@ -2,7 +2,7 @@ const CLOSE_ALERT = 'scratch-gui/alerts/CLOSE_ALERT';
const SHOW_ALERT = 'scratch-gui/alerts/SHOW_ALERT';
const initialState = {
message: 'Peripheral error',
message: 'Alert',
visible: false
};
......@@ -11,7 +11,8 @@ const reducer = function (state, action) {
switch (action.type) {
case SHOW_ALERT:
return Object.assign({}, state, {
visible: true
visible: true,
message: action.message
});
case CLOSE_ALERT:
return Object.assign({}, state, {
......@@ -26,8 +27,11 @@ const closeAlert = function () {
return {type: CLOSE_ALERT};
};
const showAlert = function () {
return {type: SHOW_ALERT};
const showAlert = function (message) {
return {
type: SHOW_ALERT,
message
};
};
export {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment