Wocart

@wocart/storefront v3.1.0


@wocart/storefront / astro / ActionMiddlewareDeps

Interface: ActionMiddlewareDeps<TResult, TSerialized>

What runFormAction needs from getActionContext(). TSerialized is the framework's result-cookie token, opaque to this SDK: Astro 5 used a string, Astro 7 an object (SerializedActionResult). The generics thread whatever getActionContext() hands the theme straight through, so no theme ever casts.

Type Parameters

TResult

TResult extends ActionHandlerResult = ActionHandlerResult

TSerialized

TSerialized = string

Properties

action?

optional action?: ActionDescriptor<TResult>


serializeActionResult

serializeActionResult: (result) => TSerialized

Serializes an ActionResult into the cookie value (Astro's serializeActionResult).

Parameters

result

TResult

Returns

TSerialized


setActionResult

setActionResult: (name, serialized) => void

Stores the serialized action result cookie (Astro's setActionResult).

Parameters

name

string

serialized

TSerialized

Returns

void