import { RouteHandler } from "gadget-server";
const route: RouteHandler = async ({ request, reply, connections, logger }) => {
const shopify = connections.shopify.current;
if (!shopify) {
logger.error("No Shopify connection found.");
return reply.status(400).send({ error: "No shop found" });
}
try {
//logic where I use the connection to make a graphQL call to save settings in a metafield.
} catch (error) {
logger.error('Error saving settings:', error);
return reply.status(500).send({ error: 'Failed to save settings' });
}
};
export default route;
import { RouteHandler } from "gadget-server";
const route: RouteHandler = async ({ request, reply, connections, logger }) => {
const shopify = connections.shopify.current;
if (!shopify) {
logger.error("No Shopify connection found.");
return reply.status(400).send({ error: "No shop found" });
}
try {
//logic where I use the connection to make a graphQL call to save settings in a metafield.
} catch (error) {
logger.error('Error saving settings:', error);
return reply.status(500).send({ error: 'Failed to save settings' });
}
};
export default route;