mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-01 05:06:39 +00:00
Migrated short URL helper modal components to TS
This commit is contained in:
@@ -1,15 +1,5 @@
|
||||
import qs from 'qs';
|
||||
import { isEmpty, isNil, reject } from 'ramda';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export const apiErrorType = PropTypes.shape({
|
||||
type: PropTypes.string,
|
||||
detail: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
status: PropTypes.number,
|
||||
error: PropTypes.string, // Deprecated
|
||||
message: PropTypes.string, // Deprecated
|
||||
});
|
||||
|
||||
const buildShlinkBaseUrl = (url, apiVersion) => url ? `${url}/rest/v${apiVersion}` : '';
|
||||
const rejectNilProps = reject(isNil);
|
||||
|
||||
@@ -22,4 +22,5 @@ export interface ProblemDetailsError {
|
||||
status: number;
|
||||
error?: string; // Deprecated
|
||||
message?: string; // Deprecated
|
||||
[extraProps: string]: any;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isEmpty, isNil, range } from 'ramda';
|
||||
import { isEmpty, isNil, pipe, range } from 'ramda';
|
||||
import { SyntheticEvent } from 'react';
|
||||
|
||||
export type OrderDir = 'ASC' | 'DESC' | undefined;
|
||||
|
||||
@@ -22,6 +23,11 @@ export type Empty = null | undefined | '' | never[];
|
||||
|
||||
export const hasValue = <T>(value: T | Empty): value is T => !isNil(value) && !isEmpty(value);
|
||||
|
||||
export const handleEventPreventingDefault = <T>(handler: () => T) => pipe(
|
||||
(e: SyntheticEvent) => e.preventDefault(),
|
||||
handler,
|
||||
);
|
||||
|
||||
export type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user