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

160
Vistas
RTK Query API get req fails in deployed environment

I have recently deployed a my-react-app project to github pages with the npm package gh-pages.

I have an RTK Query that doesn't work in the deployed environment but still works in my dev environment. below is the code for the RTK Query and then the code calling the query in the react component.

I was wondering what could be causing the error?

    getUni: builder.query({
      query: country => ({
        url: `http://universities.hipolabs.com/search?country=${country}`,
      }),
      transformResponse: responseData => {
        const resConvert = responseData.slice()
          .sort((a, b) => a.name.localeCompare(b.name))
          .map(each => {
            return { ...each, id: nanoid() }
          });
        return universityAdapter.setAll(initialState, resConvert)
      }
    }) 
  })

const {
  isFetching,
  isSuccess,
  isUninitialized,
  isError
} = useGetUniQuery(countrySearch, {
  skip
});
const allUni = useSelector(getAllUniversity);

if (isUninitialized) {
  universityData = < h1 > Use the drop down menu to generate all Post Secondary options withen your selection < /h1>
} else if (isError) {
  universityData = < h1 > Error fetching.Please refresh page < /h1>
} else if (isSuccess) {
  universityData = allUni.filter(uni => uni.name.toLowerCase().startsWith(uniSearch.toLowerCase())).map(uni =>
    <div key = {uni.id}
    className = {CardStyles.card} >
      <h2 className = '' > 
        {uni.name} 
      </h2>
      <a href = {uni.web_pages[0]} >
        {uni.web_pages[0]} 
      < /a> 
    </div>
  )
}

about 4 years ago · Santiago Gelvez
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