const {message} = responseJson;
if (typeof message === 'string' && message.toLowerCase().trim() === 'data matched') {
// do navigation here
}
const oldVerify = (responseJson) => (responseJson === 'Data Matched');
const newVerify = (responseJson) => (typeof responseJson === 'string' && responseJson.toLowerCase().trim() === 'data matched');
const cases = ['Data Matched', 'Data matched', 'data MATCHED', ' data matched ', 'data matched'];
cases.forEach((_case) => {
console.log('======');
console.log(`Case: "${_case}"`);
console.log('Old verify:', oldVerify(_case));
console.log('New verify:', newVerify(_case));
});
const {message, userData} = responseJson;
或者const message = responseJson.message; const userData = responseJson.userData;
- wowandy