Snippet of my RxJS code:
.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));
})
The server response indicates incorrect parameter 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
Attempted to use JSON.stringify resulting in parameters being converted to a string:
rsvp: JSON.stringify({
meetup_id: action.payload,
user_id: 123,
})
Updated Params:
%{"rsvp" => "{\"meetup_id\":1,\"user_id\":123}"}