Removed checks for QR code features that were not supported on versions older than 2.6

This commit is contained in:
Alejandro Celaya
2022-05-01 10:44:12 +02:00
parent 9518ad9bb4
commit a949ec9e8e
4 changed files with 32 additions and 74 deletions

View File

@@ -2,8 +2,6 @@ import { isEmpty } from 'ramda';
import { stringifyQuery } from './query';
export interface QrCodeCapabilities {
useSizeInPath: boolean;
marginIsSupported: boolean;
errorCorrectionIsSupported: boolean;
}
@@ -21,13 +19,13 @@ export interface QrCodeOptions {
export const buildQrCodeUrl = (
shortUrl: string,
{ size, format, margin, errorCorrection }: QrCodeOptions,
{ useSizeInPath, marginIsSupported, errorCorrectionIsSupported }: QrCodeCapabilities,
{ errorCorrectionIsSupported }: QrCodeCapabilities,
): string => {
const baseUrl = `${shortUrl}/qr-code${useSizeInPath ? `/${size}` : ''}`;
const baseUrl = `${shortUrl}/qr-code`;
const query = stringifyQuery({
size: useSizeInPath ? undefined : size,
size,
format,
margin: marginIsSupported && margin > 0 ? margin : undefined,
margin: margin > 0 ? margin : undefined,
errorCorrection: errorCorrectionIsSupported ? errorCorrection : undefined,
});