Split toast wrappers into separate file
This commit is contained in:
parent
e0ddd94c01
commit
42451e14a8
3 changed files with 20 additions and 26 deletions
|
@ -4,8 +4,9 @@ import * as REACTION_TYPES from 'constants/reactions';
|
|||
import * as PAGES from 'constants/pages';
|
||||
import { SORT_BY, BLOCK_LEVEL } from 'constants/comment';
|
||||
import Lbry from 'lbry';
|
||||
import { resolveApiMessage } from 'util/api-message';
|
||||
import { parseURI, buildURI, isURIEqual } from 'util/lbryURI';
|
||||
import { devToast, doFailedSignatureToast, resolveApiMessage } from 'util/api-message';
|
||||
import { devToast, doFailedSignatureToast } from 'util/toast-wrappers';
|
||||
import { selectClaimForUri, selectClaimsByUri, selectMyChannelClaims } from 'redux/selectors/claims';
|
||||
import { doResolveUris, doClaimSearch } from 'redux/actions/claims';
|
||||
import { doToast, doSeeNotifications } from 'redux/actions/notifications';
|
||||
|
|
|
@ -1,29 +1,4 @@
|
|||
// @flow
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
|
||||
// ****************************************************************************
|
||||
// Helpers
|
||||
// ****************************************************************************
|
||||
|
||||
export function doFailedSignatureToast(dispatch: Dispatch, channelName: string) {
|
||||
dispatch(
|
||||
doToast({
|
||||
message: __('Unable to verify signature for %channel%.', { channel: channelName }),
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export function devToast(dispatch: Dispatch, msg: string) {
|
||||
// @if process.env.NODE_ENV!='production'
|
||||
console.error(msg); // eslint-disable-line
|
||||
dispatch(doToast({ isError: true, message: `DEV: ${msg}` }));
|
||||
// @endif
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Error mapping
|
||||
// ****************************************************************************
|
||||
|
||||
type ApiMsgConfig = {
|
||||
originalMsg: string | RegExp,
|
||||
|
|
18
ui/util/toast-wrappers.js
Normal file
18
ui/util/toast-wrappers.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
// @flow
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
|
||||
export function doFailedSignatureToast(dispatch: Dispatch, channelName: string) {
|
||||
dispatch(
|
||||
doToast({
|
||||
message: __('Unable to verify signature for %channel%.', { channel: channelName }),
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export function devToast(dispatch: Dispatch, msg: string) {
|
||||
// @if process.env.NODE_ENV!='production'
|
||||
console.error(msg); // eslint-disable-line
|
||||
dispatch(doToast({ isError: true, message: `DEV: ${msg}` }));
|
||||
// @endif
|
||||
}
|
Loading…
Reference in a new issue