mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-18 05:23:49 +00:00
Removed redundant types
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user