Skip to content

Commit

Permalink
Merge pull request #1001 from Onlineberatung/feat/add-504-error
Browse files Browse the repository at this point in the history
feat: add 504 error response
  • Loading branch information
web-mi authored Feb 1, 2024
2 parents 980ccf0 + 714b73f commit a7783e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/api/apiPatchUserData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const apiPatchUserData = async (data): Promise<any> => {
rcValidation: true,
responseHandling: [
FETCH_ERRORS.BAD_REQUEST,
FETCH_ERRORS.FAILED_DEPENDENCY
FETCH_ERRORS.FAILED_DEPENDENCY,
FETCH_ERRORS.GATEWAY_TIMEOUT
]
});
};
6 changes: 6 additions & 0 deletions src/api/fetchData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const FETCH_ERRORS = {
EMPTY: 'EMPTY',
FAILED_DEPENDENCY: 'FAILED_DEPENDENCY',
FORBIDDEN: 'FORBIDDEN',
GATEWAY_TIMEOUT: 'GATEWAY_TIMEOUT',
NO_MATCH: 'NO_MATCH',
TIMEOUT: 'TIMEOUT',
UNAUTHORIZED: 'UNAUTHORIZED',
Expand Down Expand Up @@ -216,6 +217,11 @@ export const fetchData = ({
responseHandling.includes(FETCH_ERRORS.ABORTED)
) {
reject(new Error(FETCH_ERRORS.ABORTED));
} else if (
response.status === 504 &&
responseHandling.includes(FETCH_ERRORS.GATEWAY_TIMEOUT)
) {
reject(new Error(FETCH_ERRORS.GATEWAY_TIMEOUT));
} else if (response.status === 401) {
logout(true, appConfig.urls.toLogin);
}
Expand Down

0 comments on commit a7783e2

Please sign in to comment.