Skip to main content

Function: withSiteOperation()

withSiteOperation(operationName: string, operation: () => Promise<void>, params: UnknownRecord, deps: SiteOperationsDependencies, syncAfter: boolean): Promise<void>

Defined in: src/stores/sites/utils/operationHelpers.ts:87

Wraps a site operation with consistent logging, error handling, and optional sync. Eliminates duplication of the common pattern used across all site operations.

Parametersโ€‹

operationNameโ€‹

string

Name of the operation for logging and error handling

operationโ€‹

() => Promise<void>

The async operation to execute

paramsโ€‹

UnknownRecord

Parameters passed to the operation for logging

depsโ€‹

SiteOperationsDependencies

Site operation dependencies

syncAfterโ€‹

boolean = true

Whether to sync from backend after the operation

Returnsโ€‹

Promise<void>

Promise that resolves when operation and optional sync complete