Open mastersoftwaremedia opened 7 years ago
you have to solved the first error first, which is undefined. i encountered the same issue though not to be exact.
@mastersoftwaremedia You probably have single quotes inside your options object in fetch method (in saveGame action in actions.js) https://stackoverflow.com/questions/35852192/uncaught-in-promise-syntaxerror-unexpected-token-in-fetch-function
Thank you for the replies. I did look for the single quotes as you suggested, but found none. Does it work for you?
in chrome, go to redux tools and see what's the output, as mentioned by @andrei-sheina, the error might come from your actions.js, and you should check on your games reducers too.
I get same issue. were you able to solve it?
I have a same issue. how to solve it?
MongoDB syntax has changed since this video. Update your get
request to this:
app.get("/api/games", (req, res) => {
db
.db("crudwithredux")
.collection("games")
.find({})
.toArray((err, games) => {
res.json({ games })
})
})
I'm getting same since i made a change to my service worker script
Hello, I'm also getting the same error of "Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0" Here is my code...
getWeather = async (e) => {
e.preventDefault();
const city = e.target.elements.city.value;
const country = e.target.elements.country.value;
const api_call = await fetch(api.openweathermap.org/data/2.5/ weather?q=${city},${country}&appid=${API_KEY}
);
const data = await api_call.json();
console.log(data);
}
The error comes when there is an error in the javascript code, I faced it once, my code was live this
const mymap = L.map('mine').setView([-26.2042,28.0473], 5); // const langlong = L.marker([0, 0]).addTo(mymap);
// saying this tiles are comming from open sorce
const attribution = 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors';
const tileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
//The create the tile of the map
const tiles = L.tileLayer (tileUrl, { attribution });
//add to the page
tiles.addTo(mymap);
const api_url = 'https:://www.mwpf.co.za/ecodashboardLive/public/livechart/map';
async function getCordinates () {
const response = await fetch(api_url);
//Turn the data from the string to JSON
const data = await response.json();
as you can see on the URL there are a double semi-colon, once I fixed it I solved it
MongoDB syntax has changed since this video. Update your
get
request to this:app.get("/api/games", (req, res) => { db .db("crudwithredux") .collection("games") .find({}) .toArray((err, games) => { res.json({ games }) }) })
can you please share the complete page of server.js
I am getting nothing in games array... please help
Hi all, I am having a trouble with this "Unexpected token < in JSON at position 0." I tried to utilize all the help I can get from online and still no luck. Anyone has an idea what is going on with this? I followed the code as it is and I am getting error. I am running crud at 3000 and backend at 8080 and they are both running without crushing on each other. I even checked the backend part and it is working fine. Since error occurred, the redux devtool extension or the state of fetching games is not in proper session. Thank you in advance!