[build] upgrade eslint to 9.37.0 (#88)
Co-authored-by: tobi <tobi.smethurst@protonmail.com> Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/88 Co-authored-by: Zoë Bijl <moiety@noreply.codeberg.org> Co-committed-by: Zoë Bijl <moiety@noreply.codeberg.org>
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { showLoading, hideLoading } from 'react-redux-loading-bar';
|
||||
import type { AnyAction, Middleware } from 'redux';
|
||||
import { showLoading, hideLoading } from "react-redux-loading-bar";
|
||||
import { type AnyAction, type Middleware } from "redux";
|
||||
|
||||
import type { RootState } from '..';
|
||||
import { type RootState } from "..";
|
||||
|
||||
interface Config {
|
||||
promiseTypeSuffixes?: string[];
|
||||
promiseTypeSuffixes?: string[],
|
||||
}
|
||||
|
||||
const defaultTypeSuffixes: Config['promiseTypeSuffixes'] = [
|
||||
'PENDING',
|
||||
'FULFILLED',
|
||||
'REJECTED',
|
||||
const defaultTypeSuffixes: Config["promiseTypeSuffixes"] = [
|
||||
"PENDING",
|
||||
"FULFILLED",
|
||||
"REJECTED",
|
||||
];
|
||||
|
||||
export const loadingBarMiddleware = (
|
||||
@@ -20,26 +20,26 @@ export const loadingBarMiddleware = (
|
||||
|
||||
return ({ dispatch }) =>
|
||||
(next) =>
|
||||
(action: AnyAction) => {
|
||||
if (action.type && !action.skipLoading) {
|
||||
const [PENDING, FULFILLED, REJECTED] = promiseTypeSuffixes;
|
||||
(action: AnyAction) => {
|
||||
if (action.type && !action.skipLoading) {
|
||||
const [PENDING, FULFILLED, REJECTED] = promiseTypeSuffixes;
|
||||
|
||||
const isPending = new RegExp(`${PENDING}$`, 'g');
|
||||
const isFulfilled = new RegExp(`${FULFILLED}$`, 'g');
|
||||
const isRejected = new RegExp(`${REJECTED}$`, 'g');
|
||||
const isPending = new RegExp(`${PENDING}$`, "g");
|
||||
const isFulfilled = new RegExp(`${FULFILLED}$`, "g");
|
||||
const isRejected = new RegExp(`${REJECTED}$`, "g");
|
||||
|
||||
if (typeof action.type === 'string') {
|
||||
if (action.type.match(isPending)) {
|
||||
dispatch(showLoading());
|
||||
} else if (
|
||||
action.type.match(isFulfilled) ??
|
||||
if (typeof action.type === "string") {
|
||||
if (action.type.match(isPending)) {
|
||||
dispatch(showLoading());
|
||||
} else if (
|
||||
action.type.match(isFulfilled) ??
|
||||
action.type.match(isRejected)
|
||||
) {
|
||||
dispatch(hideLoading());
|
||||
) {
|
||||
dispatch(hideLoading());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return next(action);
|
||||
};
|
||||
return next(action);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user