diff --git a/src/redux/drugs/drugs.types.ts b/src/redux/drugs/drugs.types.ts index fb38d5e08b78dac4d9a905c66298312dae207549..c66d1574115a9fe95b9b75ad79d55f70cbcd7459 100644 --- a/src/redux/drugs/drugs.types.ts +++ b/src/redux/drugs/drugs.types.ts @@ -1,8 +1,4 @@ -import { Loading } from '@/types/loadingState'; +import { FetchDataState } from '@/types/fetchDataState'; import { Drug } from '@/types/models'; -export type DrugsState = { - data: Drug[] | undefined; - loading: Loading; - error: Error; -}; +export type DrugsState = FetchDataState<Drug[]>; diff --git a/src/types/fetchDataState.ts b/src/types/fetchDataState.ts new file mode 100644 index 0000000000000000000000000000000000000000..918bfd462f842f81ba7f9ba4ec373c29be2eb0dd --- /dev/null +++ b/src/types/fetchDataState.ts @@ -0,0 +1,7 @@ +import { Loading } from './loadingState'; + +export type FetchDataState<T> = { + data: T | undefined; + loading: Loading; + error: Error; +};