mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
Add attachments to workflow
This commit is contained in:
@@ -83,6 +83,10 @@ export const makeFetch = <Input, Output>(
|
||||
opts = Object.assign(opts, options);
|
||||
}
|
||||
return fetch(url, opts).then((response) => {
|
||||
if (response.status === 204) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
@@ -173,18 +177,26 @@ function _fetchAction<T>(
|
||||
|
||||
throw new Error("other network error");
|
||||
})
|
||||
.catch((reason: any) => {
|
||||
console.error(reason);
|
||||
throw new Error(reason);
|
||||
});
|
||||
.catch(
|
||||
(
|
||||
reason:
|
||||
| NotFoundExceptionInterface
|
||||
| ServerExceptionInterface
|
||||
| ValidationExceptionInterface
|
||||
| TransportExceptionInterface,
|
||||
) => {
|
||||
console.error(reason);
|
||||
throw reason;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const fetchResults = async <T>(
|
||||
uri: string,
|
||||
params?: FetchParams,
|
||||
): Promise<T[]> => {
|
||||
let promises: Promise<T[]>[] = [],
|
||||
page = 1;
|
||||
const promises: Promise<T[]>[] = [];
|
||||
let page = 1;
|
||||
const firstData: PaginationResponse<T> = (await _fetchAction(
|
||||
page,
|
||||
uri,
|
||||
@@ -229,6 +241,7 @@ const ValidationException = (
|
||||
return error;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const AccessException = (response: Response): AccessExceptionInterface => {
|
||||
const error = {} as AccessExceptionInterface;
|
||||
error.name = "AccessException";
|
||||
@@ -237,6 +250,7 @@ const AccessException = (response: Response): AccessExceptionInterface => {
|
||||
return error;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const NotFoundException = (response: Response): NotFoundExceptionInterface => {
|
||||
const error = {} as NotFoundExceptionInterface;
|
||||
error.name = "NotFoundException";
|
||||
@@ -257,6 +271,7 @@ const ServerException = (
|
||||
};
|
||||
|
||||
const ConflictHttpException = (
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
response: Response,
|
||||
): ConflictHttpExceptionInterface => {
|
||||
const error = {} as ConflictHttpExceptionInterface;
|
||||
|
Reference in New Issue
Block a user