Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
La propiedad 'datos' no existe en el tipo 'vacío' en la acción Redux

Al intentar ejecutar esta acción, y mientras obtengo los datos correctos en respuesta en el backend, la variable data vuelve indefinida. También recibo un error de TS que dice que Property 'data' does not exist on type 'void'

acción/iglesias.js

 export const getChurchesBySearch = (searchQuery) => async (dispatch) => { try { const { data } = await apis.getChurchesBySearch(searchQuery); dispatch({ type: "FETCH_BY_SEARCH", payload: data }); } catch (error) { console.log(error.message); } };

Como mencioné, la respuesta correcta se devuelve en el backend, pero cuando se asigna a data , data no están definidos.

Aquí están los otros archivos:
apis/iglesias.js

 export const getChurchesBySearch = (searchQuery) => { console.log(searchQuery.city); axios.get( `${url}/search?city=${searchQuery.city}&denom=${searchQuery.denom}` ); };

controlador/iglesias.js

 export const getChurchesBySearch = async (req, res) => { const { city, denom } = req.query; try { const churches = await Church.find({ $or: [{ city: city }, { denom: denom }], }).sort({ attend: -1 }); res.status(200).json(churches); } catch (error) { res.status(404).json({ message: error.message }); } };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Le falta la declaración de return en la función getChurchesBySearch .

 export const getChurchesBySearch = (searchQuery) => { console.log(searchQuery.city); return axios.get( `${url}/search?city=${searchQuery.city}&denom=${searchQuery.denom}` ); };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!