diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2018-06-09 18:17:00 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2018-06-09 18:17:00 +0200 |
commit | 41aef177ca458be9e83ffc9f3436299dcbc9845e (patch) | |
tree | 9e3603c3adb08007f77f78228e0a00993dde38d3 /frontend/src/sagas | |
parent | Fix home screen style (diff) | |
download | seven-wonders-41aef177ca458be9e83ffc9f3436299dcbc9845e.tar.gz seven-wonders-41aef177ca458be9e83ffc9f3436299dcbc9845e.tar.bz2 seven-wonders-41aef177ca458be9e83ffc9f3436299dcbc9845e.zip |
Use blueprint for error toasts instead of react-redux-toaster
Error toasts were broken. Since blueprintjs already provides a toasting
feature, we don't need the extra dependency.
What we lose here is the redux-managed state of toasts, which might lead
me to switch back later on. For now, these are quite fine.
Diffstat (limited to 'frontend/src/sagas')
-rw-r--r-- | frontend/src/sagas/errors.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/frontend/src/sagas/errors.js b/frontend/src/sagas/errors.js index 84bd044b..15287645 100644 --- a/frontend/src/sagas/errors.js +++ b/frontend/src/sagas/errors.js @@ -1,11 +1,13 @@ // @flow -import { toastr } from 'react-redux-toastr'; +import { Toaster } from '@blueprintjs/core'; import type { Channel, SagaIterator } from 'redux-saga'; import { eventChannel } from 'redux-saga'; import { apply, cancelled, take } from 'redux-saga/effects'; import type { ApiError } from '../api/model'; import type { SevenWondersSession } from '../api/sevenWondersApi'; +const ErrorToaster = Toaster.create(); + export function* errorHandlingSaga(session: SevenWondersSession): SagaIterator { const errorChannel: Channel = yield eventChannel(session.watchErrors()); try { @@ -24,7 +26,7 @@ export function* errorHandlingSaga(session: SevenWondersSession): SagaIterator { function* handleOneError(err: ApiError): * { console.error('Error received on web socket channel', err); const msg = buildMsg(err); - yield apply(toastr, toastr.error, [msg, { icon: 'error' }]); + yield apply(ErrorToaster, ErrorToaster.show, [{ intent: 'danger', icon: 'error', message: msg }]); } function buildMsg(err: ApiError): string { |