mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 17:51:36 +01:00
[Glitch] Remove usage of non-public RTK types
Port 57a1f86626
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
f0f2ce2855
commit
7bb171a9ea
1 changed files with 10 additions and 20 deletions
|
@ -1,9 +1,8 @@
|
||||||
|
import type { GetThunkAPI } from '@reduxjs/toolkit';
|
||||||
import { createAsyncThunk } from '@reduxjs/toolkit';
|
import { createAsyncThunk } from '@reduxjs/toolkit';
|
||||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
import type { BaseThunkAPI } from '@reduxjs/toolkit/src/createAsyncThunk';
|
|
||||||
|
|
||||||
import type { AppDispatch, RootState } from './store';
|
import type { AppDispatch, RootState } from './store';
|
||||||
|
|
||||||
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
|
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
|
||||||
|
@ -25,29 +24,20 @@ export const createAppAsyncThunk = createAsyncThunk.withTypes<{
|
||||||
rejectValue: AsyncThunkRejectValue;
|
rejectValue: AsyncThunkRejectValue;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
type AppThunkApi = Pick<
|
interface AppThunkConfig {
|
||||||
BaseThunkAPI<
|
|
||||||
RootState,
|
|
||||||
unknown,
|
|
||||||
AppDispatch,
|
|
||||||
AsyncThunkRejectValue,
|
|
||||||
AppMeta,
|
|
||||||
AppMeta
|
|
||||||
>,
|
|
||||||
'getState' | 'dispatch'
|
|
||||||
>;
|
|
||||||
|
|
||||||
interface AppThunkOptions {
|
|
||||||
skipLoading?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const createBaseAsyncThunk = createAsyncThunk.withTypes<{
|
|
||||||
state: RootState;
|
state: RootState;
|
||||||
dispatch: AppDispatch;
|
dispatch: AppDispatch;
|
||||||
rejectValue: AsyncThunkRejectValue;
|
rejectValue: AsyncThunkRejectValue;
|
||||||
fulfilledMeta: AppMeta;
|
fulfilledMeta: AppMeta;
|
||||||
rejectedMeta: AppMeta;
|
rejectedMeta: AppMeta;
|
||||||
}>();
|
}
|
||||||
|
type AppThunkApi = Pick<GetThunkAPI<AppThunkConfig>, 'getState' | 'dispatch'>;
|
||||||
|
|
||||||
|
interface AppThunkOptions {
|
||||||
|
skipLoading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const createBaseAsyncThunk = createAsyncThunk.withTypes<AppThunkConfig>();
|
||||||
|
|
||||||
export function createThunk<Arg = void, Returned = void>(
|
export function createThunk<Arg = void, Returned = void>(
|
||||||
name: string,
|
name: string,
|
||||||
|
|
Loading…
Reference in a new issue