Latest solutions
Rock, Paper, Scissors game
#framer-motion#redux-toolkit#tailwind-css#reactSubmitted almost 2 years agoCountries API with color theme switcher
#pinia#typescript#vue#tailwind-cssSubmitted almost 2 years ago
Latest comments
- @rizkiismail9a@otr-web-study
Hi, Muhamad Rizki Ismail. Try to put data in the store using the useFetch's interceptor onResponse. Something like this:
await useFetch(API_URL, { onResponse({ response }) { const data = response._data; // put your data in the store here }, });
As for getting the client's IP address, then you need to take into account the fact that the code from the server folder is always executed in the context of the server, i.e. in your case, this code is executed on the netlify.app server. To get the client's address, you can use the HTTP header - x-forwarded-for. For example, like this:
export default defineEventHandler((event) => { const clientIP = event.node.req.headers['x-forwarded-for']; // fetch clientIP's information here });
Marked as helpful