mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
made tags panel
This commit is contained in:
parent
f2289f4530
commit
c4f60f3d81
31 changed files with 552 additions and 75 deletions
|
@ -23,15 +23,12 @@ export const HTTP_RESPONSES = {
|
|||
TOO_MANY_REQUESTS: 429,
|
||||
};
|
||||
|
||||
export const resultMiddleware = <T extends {}>({
|
||||
export const resultMiddleware = <T extends any>({ status, data }: { status; data: T }) => ({
|
||||
status,
|
||||
data,
|
||||
}: {
|
||||
status: number;
|
||||
data: T;
|
||||
}): { status: number; data: T } => ({ status, data });
|
||||
});
|
||||
|
||||
export const errorMiddleware = <T extends any>(debug): IResultWithStatus<T> =>
|
||||
export const errorMiddleware = <T extends any = any>(debug): IResultWithStatus<T> =>
|
||||
debug && debug.response
|
||||
? {
|
||||
status: debug.response.status,
|
||||
|
@ -41,7 +38,7 @@ export const errorMiddleware = <T extends any>(debug): IResultWithStatus<T> =>
|
|||
}
|
||||
: {
|
||||
status: HTTP_RESPONSES.CONNECTION_REFUSED,
|
||||
data: {} as T & IApiErrorResult,
|
||||
data: {} as T & IApiErrorResult & any,
|
||||
debug,
|
||||
error: 'Ошибка сети',
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue