2024-01-08 10:57:40 +00:00
|
|
|
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
2023-09-11 14:09:22 +00:00
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
|
|
|
import type { AppDispatch, RootState } from './store';
|
|
|
|
|
2024-01-19 09:41:03 +00:00
|
|
|
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
|
|
|
|
export const useAppSelector = useSelector.withTypes<RootState>();
|
2023-09-11 14:09:22 +00:00
|
|
|
|
2024-03-29 13:57:39 +00:00
|
|
|
export interface AsyncThunkRejectValue {
|
|
|
|
skipAlert?: boolean;
|
|
|
|
skipNotFound?: boolean;
|
|
|
|
error?: unknown;
|
|
|
|
}
|
|
|
|
|
2023-09-11 14:09:22 +00:00
|
|
|
export const createAppAsyncThunk = createAsyncThunk.withTypes<{
|
|
|
|
state: RootState;
|
|
|
|
dispatch: AppDispatch;
|
2024-03-29 13:57:39 +00:00
|
|
|
rejectValue: AsyncThunkRejectValue;
|
2023-09-11 14:09:22 +00:00
|
|
|
}>();
|