Arrow functions and so

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-05-13 01:18:04 +02:00
parent 615ec68931
commit a58c52631e
352 changed files with 2894 additions and 3693 deletions

View File

@ -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 =>

View File

@ -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,
};