diff --git a/packages/fetch-state-machine/src/base.ts b/packages/fetch-state-machine/src/base.ts index 5cd19a5..69e6ad0 100644 --- a/packages/fetch-state-machine/src/base.ts +++ b/packages/fetch-state-machine/src/base.ts @@ -1,9 +1,4 @@ -import { - AlwatrFluxStateMachineBase, - type StateRecord, - type ActionRecord, - type AlwatrFluxStateMachineConfig -} from '@alwatr/fsm'; +import {AlwatrFluxStateMachineBase, type StateRecord, type ActionRecord, type AlwatrFluxStateMachineConfig} from '@alwatr/fsm'; import {packageTracer, fetch, type FetchOptions} from '@alwatr/nanolib'; __dev_mode__: packageTracer.add(__package_name__, __package_version__); @@ -13,7 +8,7 @@ export type ServerRequestEvent = 'request' | 'requestFailed' | 'requestSucceeded export type {FetchOptions}; -export interface AlwatrFetchStateMachineConfig extends AlwatrFluxStateMachineConfig { +export interface AlwatrFetchStateMachineConfig extends Omit, 'initialState'> { fetch: Partial; } @@ -47,7 +42,10 @@ export abstract class AlwatrFetchStateMachineBase< constructor(config: AlwatrFetchStateMachineConfig) { config.loggerPrefix ??= 'fetch-state-machine'; - super(config); + super({ + ...config, + initialState: 'initial', + }); this.baseFetchOptions_ = config.fetch; }