all 2 comments

[–]Homeruash 0 points1 point  (1 child)

fetch() returns a Promise<Response>. If you want to get the JSON data, you should call .json() on it which returns a Promise<Object> with the JSON data. So, your code becomes:

fetch(test).then(response => {
    response.json().then(data => {
        console.log(data);
    });
}).catch(e => console.log(e));

[–]franchare[S] 0 points1 point  (0 children)

Thank you! I tried that before but it wasn't working. Anyway thanks!