mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Removed redundant types
This commit is contained in:
parent
526d7195bc
commit
ea199dbf8f
4 changed files with 13 additions and 20 deletions
|
@ -21,6 +21,11 @@ export interface ShortUrlData extends EditShortUrlData {
|
|||
findIfExists?: boolean;
|
||||
}
|
||||
|
||||
export interface ShortUrlIdentifier {
|
||||
shortCode: string;
|
||||
domain?: OptionalString;
|
||||
}
|
||||
|
||||
export interface ShortUrl {
|
||||
shortCode: string;
|
||||
shortUrl: string;
|
||||
|
@ -47,11 +52,6 @@ export interface ShortUrlModalProps {
|
|||
toggle: () => void;
|
||||
}
|
||||
|
||||
export interface ShortUrlIdentifier {
|
||||
shortCode: string;
|
||||
domain: OptionalString;
|
||||
}
|
||||
|
||||
export const SHORT_URLS_ORDERABLE_FIELDS = {
|
||||
dateCreated: 'Created at',
|
||||
shortCode: 'Short URL',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { useEffect, useState } from 'react';
|
||||
import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
|
||||
import { pipe } from 'ramda';
|
||||
import { DeleteShortUrl, ShortUrlDeletion } from '../reducers/shortUrlDeletion';
|
||||
import { ShortUrlModalProps } from '../data';
|
||||
import { ShortUrlDeletion } from '../reducers/shortUrlDeletion';
|
||||
import { ShortUrlIdentifier, ShortUrlModalProps } from '../data';
|
||||
import { handleEventPreventingDefault } from '../../utils/utils';
|
||||
import { Result } from '../../utils/Result';
|
||||
import { isInvalidDeletionError } from '../../api/utils';
|
||||
|
@ -10,7 +10,7 @@ import { ShlinkApiError } from '../../api/ShlinkApiError';
|
|||
|
||||
interface DeleteShortUrlModalConnectProps extends ShortUrlModalProps {
|
||||
shortUrlDeletion: ShortUrlDeletion;
|
||||
deleteShortUrl: (shortUrl: DeleteShortUrl) => void;
|
||||
deleteShortUrl: (shortUrl: ShortUrlIdentifier) => void;
|
||||
resetDeleteShortUrl: () => void;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import { createAsyncThunk } from '../../utils/helpers/redux';
|
|||
import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';
|
||||
import { parseApiError } from '../../api/utils';
|
||||
import { ProblemDetailsError } from '../../api/types/errors';
|
||||
import { ShortUrlIdentifier } from '../data';
|
||||
|
||||
export const SHORT_URL_DELETED = 'shlink/deleteShortUrl/SHORT_URL_DELETED';
|
||||
|
||||
|
@ -14,12 +15,7 @@ export interface ShortUrlDeletion {
|
|||
errorData?: ProblemDetailsError;
|
||||
}
|
||||
|
||||
export interface DeleteShortUrl {
|
||||
shortCode: string;
|
||||
domain?: string | null;
|
||||
}
|
||||
|
||||
export type DeleteShortUrlAction = PayloadAction<DeleteShortUrl>;
|
||||
export type DeleteShortUrlAction = PayloadAction<ShortUrlIdentifier>;
|
||||
|
||||
const initialState: ShortUrlDeletion = {
|
||||
shortCode: '',
|
||||
|
@ -31,7 +27,7 @@ const initialState: ShortUrlDeletion = {
|
|||
export const shortUrlDeletionReducerCreator = (buildShlinkApiClient: ShlinkApiClientBuilder) => {
|
||||
const deleteShortUrl = createAsyncThunk(
|
||||
SHORT_URL_DELETED,
|
||||
async ({ shortCode, domain }: DeleteShortUrl, { getState }): Promise<DeleteShortUrl> => {
|
||||
async ({ shortCode, domain }: ShortUrlIdentifier, { getState }): Promise<ShortUrlIdentifier> => {
|
||||
const { deleteShortUrl: shlinkDeleteShortUrl } = buildShlinkApiClient(getState);
|
||||
await shlinkDeleteShortUrl(shortCode, domain);
|
||||
return { shortCode, domain };
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||
import { createAsyncThunk } from '../../utils/helpers/redux';
|
||||
import { OptionalString } from '../../utils/utils';
|
||||
import { EditShortUrlData, ShortUrl } from '../data';
|
||||
import { EditShortUrlData, ShortUrl, ShortUrlIdentifier } from '../data';
|
||||
import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';
|
||||
import { parseApiError } from '../../api/utils';
|
||||
import { ProblemDetailsError } from '../../api/types/errors';
|
||||
|
@ -16,9 +15,7 @@ export interface ShortUrlEdition {
|
|||
errorData?: ProblemDetailsError;
|
||||
}
|
||||
|
||||
export interface EditShortUrl {
|
||||
shortCode: string;
|
||||
domain?: OptionalString;
|
||||
export interface EditShortUrl extends ShortUrlIdentifier {
|
||||
data: EditShortUrlData;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue