mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-27 12:16:36 +00:00
Added support for API v3 error types on different error handlers
This commit is contained in:
@@ -17,10 +17,10 @@ import {
|
||||
ShlinkDomainRedirects,
|
||||
ShlinkShortUrlsListParams,
|
||||
ShlinkShortUrlsListNormalizedParams,
|
||||
ProblemDetailsError,
|
||||
} from '../types';
|
||||
import { orderToString } from '../../utils/helpers/ordering';
|
||||
import { isRegularNotFound } from '../utils';
|
||||
import { isRegularNotFound, parseApiError } from '../utils';
|
||||
import { ProblemDetailsError } from '../types/errors';
|
||||
|
||||
const buildShlinkBaseUrl = (url: string, version: 2 | 3) => `${url}/rest/v${version}`;
|
||||
const rejectNilProps = reject(isNil);
|
||||
@@ -129,7 +129,7 @@ export class ShlinkApiClient {
|
||||
data: body,
|
||||
paramsSerializer: { indexes: false },
|
||||
}).catch((e: AxiosError<ProblemDetailsError>) => {
|
||||
if (!isRegularNotFound(e.response?.data)) {
|
||||
if (!isRegularNotFound(parseApiError(e))) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user