i have one function which checks for user authorization
export const authUser = (rideId,action) => {
return (dispatch, getState) => {
const postData = {
consumer: "Rapi",
classId: rideId,
action: action,
};
return Api.post(
'/api/xx/yy/auth',
postData,
)
.then((response) => {
const authorized = response && response.authorized === true;
if (authorized) {
console.log("User is authorized");
return true;
} else {
console.warn("User is NOT authorized");
return false;
}
})
.catch((error) => {
console.error(" Authorization failed:", error);
return false;
});
};
};
if user is authorized to access this particular ride in that case we are getting this below response from API
{"authorized":true}
if that particular RideId is not available or he is not authorized to access that ride we are getting below response from API
{
"message": "Ride not found. rideId: RD23435OPSMSK76772",
"errorCode": "60000",
"timestamp": "2025-07-02T08:34:57.241+00:00"
}
as of now i am displaying a common message for user not authorized and ride not found error .
But i want to display this particular message which we are receiving from API response.
so when ride Id is not found i am getting above response and catch block is executing.
We are getting response in ride not found case. so then block should get execute.
Please Help. Thanks in Advance
