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

193
Views
Property 'data' does not exist on type 'void' in Redux action

In trying to execute this action, and while I'm getting the correct data in response on the backend, the data variable is coming back undefined. I'm also getting a TS error saying Property 'data' does not exist on type 'void'

action/churches.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);
  }
};

Like I mentioned, the correct response is being returned on the backend, but when assigning it to data, data is undefined.

Here are the other files:
apis/churches.js

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

controller/churches.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

You are missing the return statement in the getChurchesBySearch function.

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!