Dropped support to send tags to the PATCH endpoint

This commit is contained in:
Alejandro Celaya
2022-05-01 10:30:51 +02:00
parent 5a0d67e409
commit 9518ad9bb4
5 changed files with 4 additions and 61 deletions

View File

@@ -80,17 +80,6 @@ export default class ShlinkApiClient {
this.performRequest(`/short-urls/${shortCode}`, 'DELETE', { domain })
.then(() => {});
/**
* @deprecated. If using Shlink 2.6.0 or greater, use updateShortUrl instead
*/
public readonly updateShortUrlTags = async (
shortCode: string,
domain: OptionalString,
tags: string[],
): Promise<string[]> =>
this.performRequest<{ tags: string[] }>(`/short-urls/${shortCode}/tags`, 'PUT', { domain }, { tags })
.then(({ data }) => data.tags);
public readonly updateShortUrl = async (
shortCode: string,
domain: OptionalString,

View File

@@ -6,7 +6,6 @@ import { EditShortUrlData, ShortUrl } from '../data';
import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';
import { ProblemDetailsError } from '../../api/types';
import { parseApiError } from '../../api/utils';
import { supportsTagsInPatch } from '../../utils/helpers/features';
import { ApiErrorAction } from '../../api/types/actions';
export const EDIT_SHORT_URL_START = 'shlink/shortUrlEdition/EDIT_SHORT_URL_START';
@@ -42,15 +41,10 @@ export const editShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) => (
) => async (dispatch: Dispatch, getState: GetState) => {
dispatch({ type: EDIT_SHORT_URL_START });
const { selectedServer } = getState();
const sendTagsSeparately = !supportsTagsInPatch(selectedServer);
const { updateShortUrl, updateShortUrlTags } = buildShlinkApiClient(getState);
const { updateShortUrl } = buildShlinkApiClient(getState);
try {
const [shortUrl] = await Promise.all([
updateShortUrl(shortCode, domain, data as any), // FIXME Parse dates
sendTagsSeparately && data.tags ? updateShortUrlTags(shortCode, domain, data.tags) : undefined,
]);
const shortUrl = await updateShortUrl(shortCode, domain, data as any); // FIXME parse dates;
dispatch<ShortUrlEditedAction>({ shortUrl, type: SHORT_URL_EDITED });
} catch (e: any) {

View File

@@ -8,7 +8,6 @@ export const supportsQrCodeSizeInQuery = serverMatchesVersions({ minVersion: '2.
export const supportsShortUrlTitle = serverMatchesVersions({ minVersion: '2.6.0' });
export const supportsOrphanVisits = supportsShortUrlTitle;
export const supportsQrCodeMargin = supportsShortUrlTitle;
export const supportsTagsInPatch = supportsShortUrlTitle;
export const supportsBotVisits = serverMatchesVersions({ minVersion: '2.7.0' });
export const supportsCrawlableVisits = supportsBotVisits;
export const supportsQrErrorCorrection = serverMatchesVersions({ minVersion: '2.8.0' });