How do we dispatch an async action with ReSwift with parameters?
I have created this async action:
func searchItems(state: AppState, store: Store<AppState>) -> Action? {
var items = [Artwork]()
HttpHelper.post(url: serverApi.search.rawValue, params: ["term": ""]) { data in
if let data = data as? [[String: Any]] {
for row in data {
items.append(Artwork(data: row))
}
DispatchQueue.main.async {
store.dispatch(UpdateItems(items: items))
}
}
}
return nil
}
To dispatch an action, I used
store.dispatch(searchItems)
Yet I do not know how to attach the search terms with the action.