H’m following a guide to create a function within my app.
After setting up default react-router template and creating POC fulfillment constraint function, I’m trying to follow the step of the above guide:
From within your app, use the handle of your function to invoke the fulfillmentConstraintRuleCreate mutation to register the FulfillmentConstraintRule.
Unfortunately i’m new to react-router, and from my limited understanding “shopify” package incapsulates oauth and session management workflows out of the box, hiding all the boilerplace. As such I can’t figure what place in the app do I hook to implement the graphql call for the function registration. I believe it has to be when I persist session to the database, but again it’s built-in. So I’m a bit lost.
Hey @Dimitry_Nechaev - you should be able to use the afterAuth hook to set up the rule registration API call. The Shopify app template does indeed handle authentication management out of the box, so I definitely agree it can be a little mysterious in terms of how to integrate the needed calls if you’re just starting up.
There’s a bit more in this issue here on Github that has a template for registering webhooks, but it could apply to your case here as well:
Let me know if I can help out further/clarify anything on my end