_mercury
_mercury2y ago

_mercury – 19-25 Aug 15

what could be wrong here ?
10 Replies
_mercury
_mercury2y ago
this route is working if i did it by a browser
const getAttributes = async () => {
const res = await fetch('/api/attributes');
console.log('res', res);

const attrs = await res.json();
console.log('d', attrs);
setAttributes(attrs);
};

useEffect(() => {
getAttributes();
}, []);
const getAttributes = async () => {
const res = await fetch('/api/attributes');
console.log('res', res);

const attrs = await res.json();
console.log('d', attrs);
setAttributes(attrs);
};

useEffect(() => {
getAttributes();
}, []);
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
console.log('res', res); not appear and method not called
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
I called it in useEffect ?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
I have another Error in the code may be it stops react
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
yes i removed the comp that creates the erropr And i see it works thx
reactibot
reactibot2y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1008818617971908608