I have some RxJS code and this is part of it:
.mergeMap(action => {
const user = store.getState().user;
return ajax.post(`${config.API_BASE_URL}/api/v1/rsvps`, {
rsvp: {
meetup_id: action.payload,
user_id: user.id,
}
})
.map(action => calendarActions.rsvpAdded(action.payload));
})
However, my server is telling me that the params are not in the right format:
[info] POST /api/v1/rsvps
[debug] Processing by ParrotApi.RsvpController.create/2
Parameters: %{"rsvp" => "[object Object]"}
Pipelines: [:api_auth]
[info] Sent 400 in 10ms
I tried using JSON.stringify but that didn't work. It just made my params a string.
rsvp: JSON.stringify({
meetup_id: action.payload,
user_id: 123,
})
Parameters: %{"rsvp" => "{\"meetup_id\":1,\"user_id\":123}"}