Versions
"ky": 0.25,
"react-native": "0.63.4"
Works fine on iOS
/** Handle the otp generation on forgotPassword */
export const sendOTP = async (email) => {
try {
const res = await ky
.post(`${userAPIURL}/users/forgotPassword`, {
json: {email: email},
})
.json();
return {success: true, message: 'OTP sent to email'};
} catch (error) {
console.log(error);
const errMsg = await error.response.json();
// console.log(errMsg);
return {success: false, message: errMsg.description};
}
};
If you have hermes enabled in react native it does not support Reflect.
You will need to polyfill Reflect.has which is the method that ky uses.
I did this using core-js by including import 'core-js/es/reflect/has'; as the first line in my entry file.
The very first paragraph of Ky:
Ky targets modern browsers and Deno.
Personally, I prefer using the in operator instead of Reflect.has(), anyway. I'm fine with changing it if the rest of the team is, too.
I'm +1
Sure
Most helpful comment
Personally, I prefer using the
inoperator instead ofReflect.has(), anyway. I'm fine with changing it if the rest of the team is, too.