mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
eslint fix
This commit is contained in:
parent
dfaac877fb
commit
fa4d51360b
81 changed files with 741 additions and 972 deletions
|
@ -1,10 +1,10 @@
|
|||
import axios, { AxiosRequestConfig } from 'axios';
|
||||
import { push } from 'connected-react-router';
|
||||
import { API } from '~/constants/api';
|
||||
import { store } from '~/redux/store';
|
||||
import { push } from 'connected-react-router';
|
||||
import { IResultWithStatus } from '~/redux/types';
|
||||
|
||||
export const authMiddleware = r => {
|
||||
export const authMiddleware = (r) => {
|
||||
store.dispatch(push('/login'));
|
||||
return r;
|
||||
};
|
||||
|
@ -23,18 +23,15 @@ export const HTTP_RESPONSES = {
|
|||
TOO_MANY_REQUESTS: 429,
|
||||
};
|
||||
|
||||
export const resultMiddleware = <T extends {}>({
|
||||
export const resultMiddleware = (<)T extends {}>({
|
||||
status,
|
||||
data,
|
||||
}: {
|
||||
status: number;
|
||||
data: T;
|
||||
}): { status: number; data: T } => {
|
||||
return data && { status, data };
|
||||
};
|
||||
}): { status: number; data: T } => data && { status, data };
|
||||
|
||||
export const errorMiddleware = <T extends any>(debug): IResultWithStatus<T> =>
|
||||
debug && debug.response
|
||||
export const errorMiddleware = <T extends any>(debug): IResultWithStatus<T> => debug && debug.response
|
||||
? debug.response
|
||||
: {
|
||||
status: HTTP_RESPONSES.CONNECTION_REFUSED,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue