Replies: 1 comment
-
Hi,
} `export function GET(e: APIEvent) {
}` |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to extract search parameters when an API route (GET) is called (I'm using Solid Start with TypeScript). However, I've found that calling useSearchParams() not only doesn't work, but it hangs the app in this setup. For example, I'm calling the API route with this URL and 2 search parameters:
localhost:3001/chart9?test=2&another=blah
and with this code in my (chart9).tsx file:
The GET function is called correctly, but the app hangs on useSeachParams().
If I put it inside a component instead (same file, replacing the GET function), it works.
and in the console, prints
{ test: '2', another: 'blah' }
, as expected.Honestly, I don't care about useSearchParams() specifically working in the GET function, but how can I extract the search parameters from an API (ie. non-component) route? I can get the whole URL called by using
arguments['0'].request.url
inside GET, and then use another library to parse out the args, but that seems wasteful since Solid probably already knows what they are?Beta Was this translation helpful? Give feedback.
All reactions