ContextActions (Recommendation Engine) (Deprecated)
ContextActions (Recommendation Engine) (Deprecated)
|
|
Headless v1 has been deprecated. We recommend using the latest version of the Coveo Headless library. |
The context action creators.
See Dispatch Actions.
Loader Function
loadContextActions
Loads the context reducer and returns possible action creators.
Parameters
-
engine:
CoreEngineThe headless engine.
Returns ContextActionCreators: The context action creators.
ContextActionCreators
addContext
Adds a new context value.
Parameters
-
payload:
AddContextActionCreatorPayloadThe action creator payload.
Returns PayloadAction<AddContextActionCreatorPayload>: A dispatchable action.
removeContext
Removes a context key-value pair.
Parameters
-
key:
stringThe key to remove from the context (for example, "age").
Returns PayloadAction<string>: A dispatchable action.
setContext
Sets the query context.
Parameters
-
payload:
Record<string, ContextValue>The action creator payload.
Returns PayloadAction<ContextPayload>: A dispatchable action.
Related types
AddContextActionCreatorPayload
Properties
-
contextKey:
stringThe name of the key to store the context value in.
-
contextValue:
string | string[]The context value.