This is my saga function:-
// Sagas for Update Profile Starts //
function* updateProfileStartHandlerSaga(action){
try
{
console.log(action.payload)
const {data} = yield call(apiClient.post, '/api/v1/user/update-profile', action.payload)
if(data?.success === true)
{
yield put({type : types.UPDATE_PROFILE_SUCCESS, payload : data})
}
else
{
yield put({type : types.UPDATE_PROFILE_ERROR, payload : data.message})
}
}
catch(err)
{
yield put({type : types.UPDATE_PROFILE_ERROR, payload : err})
}
}
export function* updateProfileStartWatcherSaga(){
yield takeEvery(types.UPDATE_PROFILE_START, updateProfileStartHandlerSaga)
}
// Sagas for Update Profile Ends //
The loc console.log(action.payload) shows that the payload has the image data as well.
But when the request is made to the node js server, the image data is blank object. See the below screenshot.
I even tried to use formData, but still nothing happes.
try
{
var formData = new FormData(action.payload);
const {data} = yield call(apiClient.post, '/api/v1/user/update-profile', formData )
if(data?.success === true)
{
yield put({type : types.UPDATE_PROFILE_SUCCESS, payload : data})
}
else
{
yield put({type : types.UPDATE_PROFILE_ERROR, payload : data.message})
}
}
How can I fix this?

