Arrow functions and so
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@ -15,9 +15,8 @@ const hasResponse = (error: any): boolean => Boolean(error && error.response);
|
||||
const authorized = (error: any): boolean => error?.response?.status !== 401;
|
||||
|
||||
/** Whether the error should be shown to the user. */
|
||||
const shouldShowError = ({ type, skipAlert, error }: AnyAction): boolean => {
|
||||
return !skipAlert && hasResponse(error) && authorized(error) && isFailType(type) && !isRememberFailType(type);
|
||||
};
|
||||
const shouldShowError = ({ type, skipAlert, error }: AnyAction): boolean =>
|
||||
!skipAlert && hasResponse(error) && authorized(error) && isFailType(type) && !isRememberFailType(type);
|
||||
|
||||
/** Middleware to display Redux errors to the user. */
|
||||
const errorsMiddleware = (): Middleware =>
|
||||
|
||||
@ -11,13 +11,15 @@ interface Action extends AnyAction {
|
||||
}
|
||||
|
||||
/** Middleware to play sounds in response to certain Redux actions. */
|
||||
export default function soundsMiddleware(): Middleware {
|
||||
return () => next => anyAction => {
|
||||
const action = anyAction as Action;
|
||||
if (action.meta?.sound && soundCache[action.meta.sound]) {
|
||||
play(soundCache[action.meta.sound]);
|
||||
}
|
||||
const soundsMiddleware = (): Middleware => () => next => anyAction => {
|
||||
const action = anyAction as Action;
|
||||
if (action.meta?.sound && soundCache[action.meta.sound]) {
|
||||
play(soundCache[action.meta.sound]);
|
||||
}
|
||||
|
||||
return next(action);
|
||||
};
|
||||
}
|
||||
return next(action);
|
||||
};
|
||||
|
||||
export {
|
||||
soundsMiddleware as default,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user