ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.55k stars 106 forks source link

Question: Params usage #254

Closed bmccorm2 closed 2 years ago

bmccorm2 commented 2 years ago

I'm a bit new and couldn't find any relevant info online so i wanted to ask a question about params.

I'm trying to make a graphql query with a variable that I should get from the URL. When i run this, it tries to make the call to the graphql server before the variable is instantiated - so no variable gets passed to graphQL and i get an error. Do you know how i could get this variable before the rest of the code runs? Thanks!

export let params = {};
$: carId = params.carId;

const res = operationStore(GET_CONSUMPTION, { carId });
query(res);
ItalyPaleAle commented 2 years ago

I would need to see more of the code to be able to help, and get some context.

bmccorm2 commented 2 years ago

Was doing some work on it last night....I think i have my issue narrowed down to the urql client. I am indeed getting the correct URL parameters from the router so I'm going to close this. Thanks for the response :)