mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-27 20:26:40 +00:00
Dropped support to send tags to the PATCH endpoint
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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' });
|
||||
|
||||
Reference in New Issue
Block a user