Neviem si dat rady s takýmto niečím
Kód: Vybrať všetko
import React, { Component } from 'react'
import Link from 'next/link';
import Router from 'next/router';
import fetch from 'isomorphic-unfetch';
import Auth from '../components/Auth';
import Page from '../components/layouts/page';
class Inventory extends Component {
async componentDidMount() {
const res = await fetch("https://steamcommunity.com/profiles/76561198019510563/inventory/json/730/2", { method: "GET", mode : "no-cors" });
const json = await res.json();
// const d = await res.text();
console.log(json);
return { data: json };
}
render() {
return (
<div>
<Page>
<div className="card text-center col-md-12 ">
</div>
</Page>
</div>
)
}
}
export default Auth(Inventory)
Uncaught (in promise) SyntaxError: Unexpected end of input json ktorý chcem dostat je validny dával som si ho do nejakých validatorov . Skúšal som to aj takto
Kód: Vybrať všetko
const res = await fetch("https://steamcommunity.com/profiles/76561198019510563/inventory/json/730/2", { method: "GET", mode : "no-cors" });
const json = await res.text();
const d = JSON.parse(json);
Kód: Vybrať všetko
fetch("https://steamcommunity.com/profiles/76561198019510563/inventory/json/730/2").then((response) => {
return response.json()
}).then((data) => {
console.log(data);
});
Samozrejme som riešenie hladal ale nič nefunguje večšinou to je rada taka ako som uviedol v 2 pripade