mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-27 12:16:36 +00:00
Use APi v3 by default, and fall back to v2 in case of not found errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { AxiosError } from 'axios';
|
||||
import { InvalidArgumentError, InvalidShortUrlDeletion, ProblemDetailsError } from '../types';
|
||||
import { InvalidArgumentError, InvalidShortUrlDeletion, ProblemDetailsError, RegularNotFound } from '../types';
|
||||
|
||||
export const parseApiError = (e: AxiosError<ProblemDetailsError>) => e.response?.data;
|
||||
|
||||
@@ -8,3 +8,6 @@ export const isInvalidArgumentError = (error?: ProblemDetailsError): error is In
|
||||
|
||||
export const isInvalidDeletionError = (error?: ProblemDetailsError): error is InvalidShortUrlDeletion =>
|
||||
error?.type === 'INVALID_SHORTCODE_DELETION' || error?.type === 'INVALID_SHORT_URL_DELETION';
|
||||
|
||||
export const isRegularNotFound = (error?: ProblemDetailsError): error is RegularNotFound =>
|
||||
error?.type === 'NOT_FOUND' && error?.status === 404;
|
||||
|
||||
Reference in New Issue
Block a user