Dynamically fetching data

Hi Team Plasmic! :blush:

I would like to dynamically fetch data from supabase using dynamic page routing.

I’ve taken a look at this https://www.youtube.com/watch?v=BxkttuUOUQg and while it was helpful I am unable to fetch the data.

I have setup something like: product/[id]. Which links to the product page. Now I want to fetch the specified id in the link. How would I do that?

Much appreciated in advance!

Hi @aihe_team

You can add a Data query which will use the id URL parameter from the dynamic page route. The data query will use the Supabase integration to fetch data from the Supabase.

Please refer to the following docs for more details

1 Like

@muhammad_asim just want to say you were right!

I would love to make video of how to get this done so it is easier for others!

1 Like

@muhammad_asim I am looking for a good example of how to use query params. I am aware of the documentation but on the documentation on how to go from 0 to hero on URL query is not quite clear to me.

The use case I am trying to achieve is that given a link e.g. xxx.xxx/page?param=value. If a user is not logged in, the login page shows and once logged in, the user is directed to the page in question.

Your help on how to achieve this in Plasmic would be appreciated!

hi @aihe_team !
I believe you are looking for a component called Condition Guard.

If you want to create a redirect - first fill out the dynamic value for the condition. True - means the user is logged in. Most likely that would be something like $ctx.auth.email
Then, you need to handle the case when the condition is equal to false – meaning that the user is not logged in. In order to do that - create an interaction “On condition false” with a “Go to page” action.
Specify the path as the dynamic value which should look something like this.

2 Likes

@alex_noel I’m grateful for the response. We will follow-up!

1 Like