mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-20 21:46:20 +00:00
Add Shlink prefix to api-contract models
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ShortUrl, ShortUrlData } from '../short-urls/data';
|
||||
import type { ShlinkShortUrl, ShortUrlData } from '../short-urls/data';
|
||||
import type {
|
||||
ShlinkDomainRedirects,
|
||||
ShlinkDomainsResponse,
|
||||
@@ -20,7 +20,7 @@ export type ShlinkApiClient = {
|
||||
|
||||
listShortUrls(params?: ShlinkShortUrlsListParams): Promise<ShlinkShortUrlsResponse>;
|
||||
|
||||
createShortUrl(options: ShortUrlData): Promise<ShortUrl>;
|
||||
createShortUrl(options: ShortUrlData): Promise<ShlinkShortUrl>;
|
||||
|
||||
getShortUrlVisits(shortCode: string, query?: ShlinkVisitsParams): Promise<ShlinkVisits>;
|
||||
|
||||
@@ -34,7 +34,7 @@ export type ShlinkApiClient = {
|
||||
|
||||
getVisitsOverview(): Promise<ShlinkVisitsOverview>;
|
||||
|
||||
getShortUrl(shortCode: string, domain?: string | null): Promise<ShortUrl>;
|
||||
getShortUrl(shortCode: string, domain?: string | null): Promise<ShlinkShortUrl>;
|
||||
|
||||
deleteShortUrl(shortCode: string, domain?: string | null): Promise<void>;
|
||||
|
||||
@@ -42,7 +42,7 @@ export type ShlinkApiClient = {
|
||||
shortCode: string,
|
||||
domain: string | null | undefined,
|
||||
body: ShlinkShortUrlData,
|
||||
): Promise<ShortUrl>;
|
||||
): Promise<ShlinkShortUrl>;
|
||||
|
||||
listTags(): Promise<ShlinkTags>;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Order } from '@shlinkio/shlink-frontend-kit';
|
||||
import type { ShortUrl, ShortUrlMeta } from '../short-urls/data';
|
||||
import type { ShlinkDeviceLongUrls, ShlinkShortUrl } from '../short-urls/data';
|
||||
import type { Visit } from '../visits/types';
|
||||
|
||||
export interface ShlinkShortUrlsResponse {
|
||||
data: ShortUrl[];
|
||||
data: ShlinkShortUrl[];
|
||||
pagination: ShlinkPaginator;
|
||||
}
|
||||
|
||||
@@ -77,11 +77,18 @@ export interface ShlinkVisitsParams {
|
||||
excludeBots?: boolean;
|
||||
}
|
||||
|
||||
export interface ShlinkShortUrlData extends ShortUrlMeta {
|
||||
export interface ShlinkShortUrlData {
|
||||
longUrl?: string;
|
||||
title?: string;
|
||||
title?: string | null;
|
||||
/** @deprecated */
|
||||
validateUrl?: boolean;
|
||||
tags?: string[];
|
||||
deviceLongUrls?: ShlinkDeviceLongUrls;
|
||||
crawlable?: boolean;
|
||||
forwardQuery?: boolean;
|
||||
validSince?: string | null;
|
||||
validUntil?: string | null;
|
||||
maxVisits?: number | null;
|
||||
}
|
||||
|
||||
export interface ShlinkDomainRedirects {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { DateTimeInput } from '../utils/dates/DateTimeInput';
|
||||
import { formatIsoDate } from '../utils/dates/helpers/date';
|
||||
import { useFeature } from '../utils/features';
|
||||
import { handleEventPreventingDefault, hasValue } from '../utils/helpers';
|
||||
import type { DeviceLongUrls, ShortUrlData } from './data';
|
||||
import type { ShlinkDeviceLongUrls, ShortUrlData } from './data';
|
||||
import { ShortUrlFormCheckboxGroup } from './helpers/ShortUrlFormCheckboxGroup';
|
||||
import { UseExistingIfFoundInfoIcon } from './UseExistingIfFoundInfoIcon';
|
||||
import './ShortUrlForm.scss';
|
||||
@@ -87,7 +87,7 @@ export const ShortUrlForm = (
|
||||
/>
|
||||
</FormGroup>
|
||||
);
|
||||
const renderDeviceLongUrlInput = (id: keyof DeviceLongUrls, placeholder: string, icon: IconProp) => (
|
||||
const renderDeviceLongUrlInput = (id: keyof ShlinkDeviceLongUrls, placeholder: string, icon: IconProp) => (
|
||||
<IconInput
|
||||
icon={icon}
|
||||
id={id}
|
||||
|
||||
@@ -1,49 +1,36 @@
|
||||
import type { Order } from '@shlinkio/shlink-frontend-kit';
|
||||
import type { ShlinkVisitsSummary } from '../../api-contract';
|
||||
import type { ShlinkShortUrlData, ShlinkVisitsSummary } from '../../api-contract';
|
||||
import type { Nullable, OptionalString } from '../../utils/helpers';
|
||||
|
||||
export interface DeviceLongUrls {
|
||||
android?: OptionalString;
|
||||
ios?: OptionalString;
|
||||
desktop?: OptionalString;
|
||||
}
|
||||
|
||||
export interface EditShortUrlData {
|
||||
longUrl?: string;
|
||||
deviceLongUrls?: DeviceLongUrls;
|
||||
tags?: string[];
|
||||
title?: string | null;
|
||||
validSince?: Date | string | null;
|
||||
validUntil?: Date | string | null;
|
||||
maxVisits?: number | null;
|
||||
validateUrl?: boolean;
|
||||
crawlable?: boolean;
|
||||
forwardQuery?: boolean;
|
||||
}
|
||||
|
||||
export interface ShortUrlData extends EditShortUrlData {
|
||||
export interface ShortUrlData extends Omit<ShlinkShortUrlData, 'deviceLongUrls'> {
|
||||
longUrl: string;
|
||||
customSlug?: string;
|
||||
shortCodeLength?: number;
|
||||
domain?: string;
|
||||
findIfExists?: boolean;
|
||||
deviceLongUrls?: {
|
||||
android?: string;
|
||||
ios?: string;
|
||||
desktop?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ShortUrlIdentifier {
|
||||
shortCode: string;
|
||||
domain?: OptionalString;
|
||||
export interface ShlinkDeviceLongUrls {
|
||||
android?: OptionalString;
|
||||
ios?: OptionalString;
|
||||
desktop?: OptionalString;
|
||||
}
|
||||
|
||||
export interface ShortUrl {
|
||||
export interface ShlinkShortUrl {
|
||||
shortCode: string;
|
||||
shortUrl: string;
|
||||
longUrl: string;
|
||||
deviceLongUrls?: Required<DeviceLongUrls>, // Optional only before Shlink 3.5.0
|
||||
deviceLongUrls?: Required<ShlinkDeviceLongUrls>, // Optional only before Shlink 3.5.0
|
||||
dateCreated: string;
|
||||
/** @deprecated */
|
||||
visitsCount: number; // Deprecated since Shlink 3.4.0
|
||||
visitsSummary?: ShlinkVisitsSummary; // Optional only before Shlink 3.4.0
|
||||
meta: Required<Nullable<ShortUrlMeta>>;
|
||||
meta: Required<Nullable<ShlinkShortUrlMeta>>;
|
||||
tags: string[];
|
||||
domain: string | null;
|
||||
title?: string | null;
|
||||
@@ -51,14 +38,19 @@ export interface ShortUrl {
|
||||
forwardQuery?: boolean;
|
||||
}
|
||||
|
||||
export interface ShortUrlMeta {
|
||||
export interface ShlinkShortUrlMeta {
|
||||
validSince?: string;
|
||||
validUntil?: string;
|
||||
maxVisits?: number;
|
||||
}
|
||||
|
||||
export interface ShortUrlIdentifier {
|
||||
shortCode: string;
|
||||
domain?: OptionalString;
|
||||
}
|
||||
|
||||
export interface ShortUrlModalProps {
|
||||
shortUrl: ShortUrl;
|
||||
shortUrl: ShlinkShortUrl;
|
||||
isOpen: boolean;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useCallback } from 'react';
|
||||
import type { ShlinkApiClient } from '../../api-contract';
|
||||
import { ExportBtn } from '../../utils/components/ExportBtn';
|
||||
import type { ReportExporter } from '../../utils/services/ReportExporter';
|
||||
import type { ShortUrl } from '../data';
|
||||
import type { ShlinkShortUrl } from '../data';
|
||||
import { useShortUrlsQuery } from './hooks';
|
||||
|
||||
export interface ExportShortUrlsBtnProps {
|
||||
@@ -21,7 +21,7 @@ export const ExportShortUrlsBtn = (
|
||||
const [loading,, startLoading, stopLoading] = useToggle();
|
||||
const exportAllUrls = useCallback(async () => {
|
||||
const totalPages = amount / itemsPerPage;
|
||||
const loadAllUrls = async (page = 1): Promise<ShortUrl[]> => {
|
||||
const loadAllUrls = async (page = 1): Promise<ShlinkShortUrl[]> => {
|
||||
const { data } = await apiClientFactory().listShortUrls(
|
||||
{ page: `${page}`, tags, searchTerm: search, startDate, endDate, orderBy, tagsMode, itemsPerPage },
|
||||
);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import type { FC } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useRoutesPrefix } from '../../utils/routesPrefix';
|
||||
import type { ShortUrl } from '../data';
|
||||
import type { ShlinkShortUrl } from '../data';
|
||||
import { urlEncodeShortCode } from './index';
|
||||
|
||||
export type LinkSuffix = 'visits' | 'edit';
|
||||
|
||||
export interface ShortUrlDetailLinkProps {
|
||||
shortUrl?: ShortUrl | null;
|
||||
shortUrl?: ShlinkShortUrl | null;
|
||||
suffix: LinkSuffix;
|
||||
asLink?: boolean;
|
||||
}
|
||||
|
||||
const buildUrl = (routePrefix: string, { shortCode, domain }: ShortUrl, suffix: LinkSuffix) => {
|
||||
const buildUrl = (routePrefix: string, { shortCode, domain }: ShlinkShortUrl, suffix: LinkSuffix) => {
|
||||
const query = domain ? `?domain=${domain}` : '';
|
||||
return `${routePrefix}/short-code/${urlEncodeShortCode(shortCode)}/${suffix}${query}`;
|
||||
};
|
||||
|
||||
@@ -6,10 +6,10 @@ import { isBefore } from 'date-fns';
|
||||
import type { FC, ReactNode } from 'react';
|
||||
import { UncontrolledTooltip } from 'reactstrap';
|
||||
import { formatHumanFriendly, now, parseISO } from '../../utils/dates/helpers/date';
|
||||
import type { ShortUrl } from '../data';
|
||||
import type { ShlinkShortUrl } from '../data';
|
||||
|
||||
interface ShortUrlStatusProps {
|
||||
shortUrl: ShortUrl;
|
||||
shortUrl: ShlinkShortUrl;
|
||||
}
|
||||
|
||||
interface StatusResult {
|
||||
@@ -18,7 +18,7 @@ interface StatusResult {
|
||||
description: ReactNode;
|
||||
}
|
||||
|
||||
const resolveShortUrlStatus = (shortUrl: ShortUrl): StatusResult => {
|
||||
const resolveShortUrlStatus = (shortUrl: ShlinkShortUrl): StatusResult => {
|
||||
const { meta, visitsCount, visitsSummary } = shortUrl;
|
||||
const { maxVisits, validSince, validUntil } = meta;
|
||||
const totalVisits = visitsSummary?.total ?? visitsCount;
|
||||
|
||||
@@ -5,12 +5,12 @@ import classNames from 'classnames';
|
||||
import { UncontrolledTooltip } from 'reactstrap';
|
||||
import { formatHumanFriendly, parseISO } from '../../utils/dates/helpers/date';
|
||||
import { prettify } from '../../utils/helpers/numbers';
|
||||
import type { ShortUrl } from '../data';
|
||||
import type { ShlinkShortUrl } from '../data';
|
||||
import { ShortUrlDetailLink } from './ShortUrlDetailLink';
|
||||
import './ShortUrlVisitsCount.scss';
|
||||
|
||||
interface ShortUrlVisitsCountProps {
|
||||
shortUrl?: ShortUrl | null;
|
||||
shortUrl?: ShlinkShortUrl | null;
|
||||
visitsCount: number;
|
||||
active?: boolean;
|
||||
asLink?: boolean;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Time } from '../../utils/dates/Time';
|
||||
import type { TimeoutToggle } from '../../utils/helpers/hooks';
|
||||
import type { ColorGenerator } from '../../utils/services/ColorGenerator';
|
||||
import { useSetting } from '../../utils/settings';
|
||||
import type { ShortUrl } from '../data';
|
||||
import type { ShlinkShortUrl } from '../data';
|
||||
import { useShortUrlsQuery } from './hooks';
|
||||
import type { ShortUrlsRowMenuType } from './ShortUrlsRowMenu';
|
||||
import { ShortUrlStatus } from './ShortUrlStatus';
|
||||
@@ -16,7 +16,7 @@ import './ShortUrlsRow.scss';
|
||||
|
||||
interface ShortUrlsRowProps {
|
||||
onTagClick?: (tag: string) => void;
|
||||
shortUrl: ShortUrl;
|
||||
shortUrl: ShlinkShortUrl;
|
||||
}
|
||||
|
||||
export type ShortUrlsRowType = FC<ShortUrlsRowProps>;
|
||||
|
||||
@@ -8,11 +8,11 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { RowDropdownBtn, useToggle } from '@shlinkio/shlink-frontend-kit';
|
||||
import type { FC } from 'react';
|
||||
import { DropdownItem } from 'reactstrap';
|
||||
import type { ShortUrl, ShortUrlModalProps } from '../data';
|
||||
import type { ShlinkShortUrl, ShortUrlModalProps } from '../data';
|
||||
import { ShortUrlDetailLink } from './ShortUrlDetailLink';
|
||||
|
||||
interface ShortUrlsRowMenuProps {
|
||||
shortUrl: ShortUrl;
|
||||
shortUrl: ShlinkShortUrl;
|
||||
}
|
||||
type ShortUrlModal = FC<ShortUrlModalProps>;
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import { isNil } from 'ramda';
|
||||
import type { OptionalString } from '../../utils/helpers';
|
||||
import type { ShortUrlCreationSettings } from '../../utils/settings';
|
||||
import { DEFAULT_DOMAIN } from '../../visits/reducers/domainVisits';
|
||||
import type { ShortUrl, ShortUrlData } from '../data';
|
||||
import type { ShlinkShortUrl, ShortUrlData } from '../data';
|
||||
|
||||
export const shortUrlMatches = (shortUrl: ShortUrl, shortCode: string, domain: OptionalString): boolean => {
|
||||
export const shortUrlMatches = (shortUrl: ShlinkShortUrl, shortCode: string, domain: OptionalString): boolean => {
|
||||
if (isNil(domain)) {
|
||||
return shortUrl.shortCode === shortCode && !shortUrl.domain;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ export const shortUrlMatches = (shortUrl: ShortUrl, shortCode: string, domain: O
|
||||
return shortUrl.shortCode === shortCode && shortUrl.domain === domain;
|
||||
};
|
||||
|
||||
export const domainMatches = (shortUrl: ShortUrl, domain: string): boolean => {
|
||||
export const domainMatches = (shortUrl: ShlinkShortUrl, domain: string): boolean => {
|
||||
if (!shortUrl.domain && domain === DEFAULT_DOMAIN) {
|
||||
return true;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export const domainMatches = (shortUrl: ShortUrl, domain: string): boolean => {
|
||||
return shortUrl.domain === domain;
|
||||
};
|
||||
|
||||
export const shortUrlDataFromShortUrl = (shortUrl?: ShortUrl, settings?: ShortUrlCreationSettings): ShortUrlData => {
|
||||
export const shortUrlDataFromShortUrl = (shortUrl?: ShlinkShortUrl, settings?: ShortUrlCreationSettings): ShortUrlData => {
|
||||
const validateUrl = settings?.validateUrls ?? false;
|
||||
|
||||
if (!shortUrl) {
|
||||
@@ -37,7 +37,11 @@ export const shortUrlDataFromShortUrl = (shortUrl?: ShortUrl, settings?: ShortUr
|
||||
maxVisits: shortUrl.meta.maxVisits ?? undefined,
|
||||
crawlable: shortUrl.crawlable,
|
||||
forwardQuery: shortUrl.forwardQuery,
|
||||
deviceLongUrls: shortUrl.deviceLongUrls,
|
||||
deviceLongUrls: shortUrl.deviceLongUrls && {
|
||||
android: shortUrl.deviceLongUrls.android ?? undefined,
|
||||
ios: shortUrl.deviceLongUrls.ios ?? undefined,
|
||||
desktop: shortUrl.deviceLongUrls.desktop ?? undefined,
|
||||
},
|
||||
validateUrl,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createSlice } from '@reduxjs/toolkit';
|
||||
import type { ProblemDetailsError, ShlinkApiClient } from '../../api-contract';
|
||||
import { parseApiError } from '../../api-contract/utils';
|
||||
import { createAsyncThunk } from '../../utils/redux';
|
||||
import type { ShortUrl, ShortUrlData } from '../data';
|
||||
import type { ShlinkShortUrl, ShortUrlData } from '../data';
|
||||
|
||||
const REDUCER_PREFIX = 'shlink/shortUrlCreation';
|
||||
|
||||
@@ -21,13 +21,13 @@ export type ShortUrlCreation = {
|
||||
error: true;
|
||||
errorData?: ProblemDetailsError;
|
||||
} | {
|
||||
result: ShortUrl;
|
||||
result: ShlinkShortUrl;
|
||||
saving: false;
|
||||
saved: true;
|
||||
error: false;
|
||||
};
|
||||
|
||||
export type CreateShortUrlAction = PayloadAction<ShortUrl>;
|
||||
export type CreateShortUrlAction = PayloadAction<ShlinkShortUrl>;
|
||||
|
||||
const initialState: ShortUrlCreation = {
|
||||
saving: false,
|
||||
@@ -37,7 +37,7 @@ const initialState: ShortUrlCreation = {
|
||||
|
||||
export const createShortUrl = (apiClientFactory: () => ShlinkApiClient) => createAsyncThunk(
|
||||
`${REDUCER_PREFIX}/createShortUrl`,
|
||||
(data: ShortUrlData): Promise<ShortUrl> => apiClientFactory().createShortUrl(data),
|
||||
(data: ShortUrlData): Promise<ShlinkShortUrl> => apiClientFactory().createShortUrl(data),
|
||||
);
|
||||
|
||||
export const shortUrlCreationReducerCreator = (createShortUrlThunk: ReturnType<typeof createShortUrl>) => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { createAction, createSlice } from '@reduxjs/toolkit';
|
||||
import type { ProblemDetailsError, ShlinkApiClient } from '../../api-contract';
|
||||
import { parseApiError } from '../../api-contract/utils';
|
||||
import { createAsyncThunk } from '../../utils/redux';
|
||||
import type { ShortUrl, ShortUrlIdentifier } from '../data';
|
||||
import type { ShlinkShortUrl, ShortUrlIdentifier } from '../data';
|
||||
|
||||
const REDUCER_PREFIX = 'shlink/shortUrlDeletion';
|
||||
|
||||
@@ -29,7 +29,7 @@ export const deleteShortUrl = (apiClientFactory: () => ShlinkApiClient) => creat
|
||||
},
|
||||
);
|
||||
|
||||
export const shortUrlDeleted = createAction<ShortUrl>(`${REDUCER_PREFIX}/shortUrlDeleted`);
|
||||
export const shortUrlDeleted = createAction<ShlinkShortUrl>(`${REDUCER_PREFIX}/shortUrlDeleted`);
|
||||
|
||||
export const shortUrlDeletionReducerCreator = (deleteShortUrlThunk: ReturnType<typeof deleteShortUrl>) => {
|
||||
const { actions, reducer } = createSlice({
|
||||
|
||||
@@ -3,19 +3,19 @@ import { createSlice } from '@reduxjs/toolkit';
|
||||
import type { ProblemDetailsError, ShlinkApiClient } from '../../api-contract';
|
||||
import { parseApiError } from '../../api-contract/utils';
|
||||
import { createAsyncThunk } from '../../utils/redux';
|
||||
import type { ShortUrl, ShortUrlIdentifier } from '../data';
|
||||
import type { ShlinkShortUrl, ShortUrlIdentifier } from '../data';
|
||||
import { shortUrlMatches } from '../helpers';
|
||||
|
||||
const REDUCER_PREFIX = 'shlink/shortUrlDetail';
|
||||
|
||||
export interface ShortUrlDetail {
|
||||
shortUrl?: ShortUrl;
|
||||
shortUrl?: ShlinkShortUrl;
|
||||
loading: boolean;
|
||||
error: boolean;
|
||||
errorData?: ProblemDetailsError;
|
||||
}
|
||||
|
||||
export type ShortUrlDetailAction = PayloadAction<ShortUrl>;
|
||||
export type ShortUrlDetailAction = PayloadAction<ShlinkShortUrl>;
|
||||
|
||||
const initialState: ShortUrlDetail = {
|
||||
loading: false,
|
||||
@@ -25,7 +25,7 @@ const initialState: ShortUrlDetail = {
|
||||
export const shortUrlDetailReducerCreator = (apiClientFactory: () => ShlinkApiClient) => {
|
||||
const getShortUrlDetail = createAsyncThunk(
|
||||
`${REDUCER_PREFIX}/getShortUrlDetail`,
|
||||
async ({ shortCode, domain }: ShortUrlIdentifier, { getState }): Promise<ShortUrl> => {
|
||||
async ({ shortCode, domain }: ShortUrlIdentifier, { getState }): Promise<ShlinkShortUrl> => {
|
||||
const { shortUrlsList } = getState();
|
||||
const alreadyLoaded = shortUrlsList?.shortUrls?.data.find((url) => shortUrlMatches(url, shortCode, domain));
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import type { PayloadAction } from '@reduxjs/toolkit';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import type { ProblemDetailsError, ShlinkApiClient } from '../../api-contract';
|
||||
import type { ProblemDetailsError, ShlinkApiClient, ShlinkShortUrlData } from '../../api-contract';
|
||||
import { parseApiError } from '../../api-contract/utils';
|
||||
import { createAsyncThunk } from '../../utils/redux';
|
||||
import type { EditShortUrlData, ShortUrl, ShortUrlIdentifier } from '../data';
|
||||
import type { ShlinkShortUrl, ShortUrlIdentifier } from '../data';
|
||||
|
||||
const REDUCER_PREFIX = 'shlink/shortUrlEdition';
|
||||
|
||||
export interface ShortUrlEdition {
|
||||
shortUrl?: ShortUrl;
|
||||
shortUrl?: ShlinkShortUrl;
|
||||
saving: boolean;
|
||||
saved: boolean;
|
||||
error: boolean;
|
||||
@@ -16,11 +15,9 @@ export interface ShortUrlEdition {
|
||||
}
|
||||
|
||||
export interface EditShortUrl extends ShortUrlIdentifier {
|
||||
data: EditShortUrlData;
|
||||
data: ShlinkShortUrlData;
|
||||
}
|
||||
|
||||
export type ShortUrlEditedAction = PayloadAction<ShortUrl>;
|
||||
|
||||
const initialState: ShortUrlEdition = {
|
||||
saving: false,
|
||||
saved: false,
|
||||
@@ -29,7 +26,7 @@ const initialState: ShortUrlEdition = {
|
||||
|
||||
export const editShortUrl = (apiClientFactory: () => ShlinkApiClient) => createAsyncThunk(
|
||||
`${REDUCER_PREFIX}/editShortUrl`,
|
||||
({ shortCode, domain, data }: EditShortUrl): Promise<ShortUrl> =>
|
||||
({ shortCode, domain, data }: EditShortUrl): Promise<ShlinkShortUrl> =>
|
||||
apiClientFactory().updateShortUrl(shortCode, domain, data as any) // TODO parse dates
|
||||
,
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { assocPath, last, pipe, reject } from 'ramda';
|
||||
import type { ShlinkApiClient, ShlinkShortUrlsListParams, ShlinkShortUrlsResponse } from '../../api-contract';
|
||||
import { createAsyncThunk } from '../../utils/redux';
|
||||
import { createNewVisits } from '../../visits/reducers/visitCreation';
|
||||
import type { ShortUrl } from '../data';
|
||||
import type { ShlinkShortUrl } from '../data';
|
||||
import { shortUrlMatches } from '../helpers';
|
||||
import type { createShortUrl } from './shortUrlCreation';
|
||||
import { shortUrlDeleted } from './shortUrlDeletion';
|
||||
@@ -82,7 +82,7 @@ export const shortUrlsListReducerCreator = (
|
||||
pipe(
|
||||
(state, { payload }) => (!state.shortUrls ? state : assocPath(
|
||||
['shortUrls', 'data'],
|
||||
reject<ShortUrl, ShortUrl[]>((shortUrl) =>
|
||||
reject<ShlinkShortUrl, ShlinkShortUrl[]>((shortUrl) =>
|
||||
shortUrlMatches(shortUrl, payload.shortCode, payload.domain), state.shortUrls.data),
|
||||
state,
|
||||
)),
|
||||
|
||||
@@ -2,7 +2,7 @@ import { faArrowLeft } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
||||
import { Button, Card } from 'reactstrap';
|
||||
import type { ShortUrl } from '../short-urls/data';
|
||||
import type { ShlinkShortUrl } from '../short-urls/data';
|
||||
import { ShortUrlVisitsCount } from '../short-urls/helpers/ShortUrlVisitsCount';
|
||||
import type { Visit } from './types';
|
||||
|
||||
@@ -10,7 +10,7 @@ type VisitsHeaderProps = PropsWithChildren<{
|
||||
visits: Visit[];
|
||||
goBack: () => void;
|
||||
title: ReactNode;
|
||||
shortUrl?: ShortUrl;
|
||||
shortUrl?: ShlinkShortUrl;
|
||||
}>;
|
||||
|
||||
export const VisitsHeader: FC<VisitsHeaderProps> = ({ visits, goBack, shortUrl, children, title }) => (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ShortUrl } from '../../short-urls/data';
|
||||
import type { ShlinkShortUrl } from '../../short-urls/data';
|
||||
import type { DateRange } from '../../utils/dates/helpers/dateIntervals';
|
||||
|
||||
export type OrphanVisitType = 'base_url' | 'invalid_short_url' | 'regular_404';
|
||||
@@ -52,7 +52,7 @@ export interface NormalizedOrphanVisit extends NormalizedRegularVisit {
|
||||
export type NormalizedVisit = NormalizedRegularVisit | NormalizedOrphanVisit;
|
||||
|
||||
export interface CreateVisit {
|
||||
shortUrl?: ShortUrl;
|
||||
shortUrl?: ShlinkShortUrl;
|
||||
visit: Visit;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user