@laserware/stasis
    Preparing search index...

    Type Alias AsyncThunkOptions<ThunkArg, ThunkApiConfig>

    AsyncThunkOptions: {
        dispatchConditionRejection?: boolean;
        idGenerator?: (arg: ThunkArg) => string;
        serializeError?: (x: unknown) => GetSerializedErrorType<ThunkApiConfig>;
        condition(
            arg: ThunkArg,
            api: Pick<GetThunkAPI<ThunkApiConfig>, "getState" | "extra">,
        ): MaybePromise<undefined | boolean>;
    } & IsUnknown<
        GetPendingMeta<ThunkApiConfig>,
        {
            getPendingMeta(
                base: { arg: ThunkArg; requestId: string },
                api: Pick<GetThunkAPI<ThunkApiConfig>, "getState" | "extra">,
            ): GetPendingMeta<ThunkApiConfig>;
        },
        {
            getPendingMeta(
                base: { arg: ThunkArg; requestId: string },
                api: Pick<GetThunkAPI<ThunkApiConfig>, "getState" | "extra">,
            ): GetPendingMeta<ThunkApiConfig>;
        },
    >

    Options object for createAsyncThunk.

    Type Parameters

    • ThunkArg = void
    • ThunkApiConfig extends AsyncThunkConfig = {}

    Type declaration

    • OptionaldispatchConditionRejection?: boolean

      If condition returns false, the asyncThunk will be skipped. This option allows you to control whether a rejected action with meta.condition == false will be dispatched or not.

      false

    • OptionalidGenerator?: (arg: ThunkArg) => string

      A function to use when generating the requestId for the request sequence.

      nanoid

    • OptionalserializeError?: (x: unknown) => GetSerializedErrorType<ThunkApiConfig>
    • condition?: function
      • A method to control whether the asyncThunk should be executed. Has access to the arg, api.getState() and api.extra arguments.

        Parameters

        Returns MaybePromise<undefined | boolean>

        false if it should be skipped