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

269
Views
El encabezado 'Access-Control-Allow-Origin' está presente en el recurso solicitado. back-end del nodo

He visto un tutorial para saber cómo funciona el kit de herramientas de redux después de ver que usa algún servicio de suministro de API en línea ahora que lo estoy usando, necesito personalizarlo para mi uso, así que cambié el nombre y las URL.

aquí está mi tienda.js

 import {configureStore} from '@reduxjs/toolkit' import {setupListeners} from '@reduxjs/toolkit/query' import { postApi } from './actions/productAction' export const store = configureStore({ reducer:{ [postApi.reducerPath]:postApi.reducer }, // middleware:(getDefaultMiddleware)=>getDefaultMiddleware().concat(postApi.middleware), // middleware is also created for us, which will allow us to take advantage of caching, invalidation, polling, and the other features of RTK Query. middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(postApi.middleware), }) setupListeners(store.dispatch)

Aquí tengo el archivo de acción que en realidad está tomando el estado de actualización de la acción

 import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' export const postApi = createApi({ reducerPath:'postApi',//this is unique path which will tell the broweser where it need to store the cookie data baseQuery: fetchBaseQuery({ baseUrl:'', }), endpoints:(builder)=>({ getAllPost: builder.query({ query:()=>({ url:'http://localhost:5000/api/v1/products', method:'GET' }) }), getPostById: builder.query({ query: (id) =>({ url:`posts/${id}`, method:'GET' }) }) }) }) export const {useGetAllPostQuery,useGetPostByIdQuery} = postApi

El lugar donde estoy llamando a esta función es

 import React from 'react' import {useGetAllPostQuery} from '../../actions/productAction' // import Card from '../../components/Card'; const HomePage = () => { console.log(useGetAllPostQuery()) const responseInfo = useGetAllPostQuery() console.log("the response i am getting is",responseInfo) return ( <> <h1>Hello worls</h1> </> ) } export default HomePage

mi consola donde estoy recibiendo no sé por qué aparece este error, la solicitud se rechaza al mismo tiempo que mi hombre de correos trabaja en eso ingrese la descripción de la imagen aquí

El error imagen ampliada

ingrese la descripción de la imagen aquí

El problema real es

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
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!