Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the location passed in through the custom router if it exists #111

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jasong689
Copy link
Contributor

@jasong689 jasong689 commented Oct 4, 2022

If a custom router is passed to the Provider we should use that to determine any query params in the URL (for things like host). This will work better for technologies like Next that may have a SSR component and have a custom router. This would allow you to do something like the following for Next:

const router = useRouter()

<GadgetProvider 
    type={AppType.Embedded}
    shopifyApiKey={process.env.NEXT_PUBLIC_SHOPIFY_API_KEY!} 
    api={api}
    router={{
        location: router.asPath,
        history: router
    }}>
...
</GadgetProvider>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant