Why cant fetch api from route handles
Unanswered
American black bear posted this in #help-forum
American black bearOP
why i cant fetch api/users and how to move the route handle iniside (protected route)/profile
5 Replies
American black bearOP
the error is
digest: '3644193594',
[cause]: [TypeError: Invalid URL] {
code: 'ERR_INVALID_URL',
input: '/api/users'
}
You wanna move the logic from the Route Handler into the page.tsx?
I would recommend abstract the logic into a function and call it directly in your server component. Making it a separate function will help in the future with caching and to avoid duplicating the logic if you need to use it somewhere else.
I would recommend abstract the logic into a function and call it directly in your server component. Making it a separate function will help in the future with caching and to avoid duplicating the logic if you need to use it somewhere else.
Asian black bear
Don't order from the McDonalds drive through when you are already inside the restaurant.
@American black bear solved?