IcyFoxer
IcyFoxer
Explore posts from servers
NNuxt
Created by IcyFoxer on 5/16/2024 in #❓・help
Ideal place for fetching initial data
As per the title where would be the best place for fetching initial data that will be stored in pinia? Currently i am handling it in an auth middleware as well as in the default layout.
2 replies
NNuxt
Created by IcyFoxer on 4/21/2023 in #❓・help
Axios or $fetch in api routes?
I'm starting a new project which requires authentication to an external backend endpoint. This is how I visualise the flow 1. use $fetch('/api/auth/login') on client side to pass data to server api 2. server api accepts the body and pass it to $fetch / axios and sends POST req to external endpoints 3. external endpoint returns response. 4. api route returns status and response to client 5. client side process the response to show success/ error response. Is this the right way to make an authentication req to external endpoints? The reason I need to make the initial request to api route is because the session is stored in the server cookie.
1 replies