-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* build, platform notifications package * index, add notifications component * rhelActions, notifications metadata * middleware, notifications options-settings * redux reducers, notifications reducer * scss, notifications stylesheet
- Loading branch information
Showing
7 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
import { createLogger } from 'redux-logger'; | ||
import promiseMiddleware from 'redux-promise-middleware'; | ||
import thunkMiddleware from 'redux-thunk'; | ||
import { notificationsMiddleware } from '@redhat-cloud-services/frontend-components-notifications'; | ||
import { reduxHelpers } from '../common/reduxHelpers'; | ||
|
||
const reduxMiddleware = [thunkMiddleware, promiseMiddleware]; | ||
const notificationsOptions = { | ||
dispatchDefaultFailure: true, // automatic error notifications | ||
pendingSuffix: reduxHelpers.PENDING_ACTION(), // pending state action suffix | ||
fulfilledSuffix: reduxHelpers.FULFILLED_ACTION(), // fulfilled state action suffix | ||
rejectedSuffix: reduxHelpers.REJECTED_ACTION(), // rejected state action suffix | ||
autoDismiss: true, // autoDismiss pending and success notifications | ||
dismissDelay: 5000, // autoDismiss delay in ms | ||
errorTitleKey: 'title', // path to notification title in error response | ||
errorDescriptionKey: 'detail' // path to notification description in error response | ||
}; | ||
|
||
const reduxMiddleware = [thunkMiddleware, promiseMiddleware, notificationsMiddleware(notificationsOptions)]; | ||
|
||
if (process.env.NODE_ENV !== 'production' && process.env.REACT_APP_DEBUG_MIDDLEWARE === 'true') { | ||
reduxMiddleware.push(createLogger()); | ||
} | ||
|
||
export { reduxMiddleware as default, reduxMiddleware, createLogger, promiseMiddleware, thunkMiddleware }; | ||
export { | ||
reduxMiddleware as default, | ||
reduxMiddleware, | ||
createLogger, | ||
notificationsMiddleware, | ||
promiseMiddleware, | ||
thunkMiddleware | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters