initial version (template only)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { ActionFunctionArgs } from "react-router";
|
||||
import { authenticate } from "../shopify.server";
|
||||
import db from "../db.server";
|
||||
|
||||
export const action = async ({ request }: ActionFunctionArgs) => {
|
||||
const { payload, session, topic, shop } = await authenticate.webhook(request);
|
||||
console.log(`Received ${topic} webhook for ${shop}`);
|
||||
|
||||
const current = payload.current as string[];
|
||||
if (session) {
|
||||
await db.session.update({
|
||||
where: {
|
||||
id: session.id
|
||||
},
|
||||
data: {
|
||||
scope: current.toString(),
|
||||
},
|
||||
});
|
||||
}
|
||||
return new Response();
|
||||
};
|
||||
Reference in New Issue
Block a user