Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
No se puede enviar la solicitud de parche a React Native

La solicitud de parche no se envía, el servidor devuelve el código 422. El parche Postman funciona bien. Tal vez no estoy enviando la solicitud correctamente. Aquí está mi código EditingPatientScreen:

 function EditingPatientScreen({route, navigation}) { const {item} = route.params; const [values, setValues] = useState({}); const handleChange = (name, e) => setValues(a => ({ ...a, [name]: e })); const onSumbit = (id) => { console.log(id) patient.put(id) .then(({ data }) => { navigation.navigate("HomeScreen"); console.log(values) }).catch(e => { console.log(e); }); }; return ( <> <View style={{ flex: 1, backgroundColor: `#ffffffff` }}> <View style={{ backgroundColor: `#ffffff` }}> <TextInput style={[styles.text_input]} label={"Имя и Фамилия"} onChangeText={ text =>handleChange("fullname", text)} value={values.fullname} autoFocus /> <TextInput style={styles.text_input} label={" Номер телефона"} keyboardType="phone-pad" dataDetectorType={"phoneNumber"} onChangeText={ text =>handleChange( "phone", text)} value={values.phone} autoFocus /> <View style={styles.viewButton}> <View style={styles.buttonContainer}> <TouchableOpacity style={styles.touchableOpacity} onPress={() => onSumbit(item._id)}> <Text style={styles.touchableOpacityText}><MaterialIcons name={"done"} size={17}/> Сохранить</Text> </TouchableOpacity> </View> </View> </View> </View> </> ); } export default EditingPatientScreen;

Aquí está mi código depatients.js. Creo que hice lo correcto aquí.

 import axios from "axios"; export default { post: values => axios.post('http://localhost:5000/patients', values), show: id => axios.get('http://localhost:5000/patients/' + id), get: () => axios.get('http://localhost:5000/patients'), remove: id => axios.delete('http://localhost:5000/patients/ ' + id), put: id => axios.patch('http://localhost:5000/patients/ ' + id), }

¿Como resolver el problema?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Hay un espacio adicional en su URL, debería verse así:

 put: id => axios.patch('http://localhost:5000/patients/' + id),
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda