Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt 2023-05-17 18:47:10 +02:00
parent ef3b65b1c0
commit a321c27376
2 changed files with 16 additions and 13 deletions

View File

@ -16,7 +16,6 @@
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"node-fetch": "^3.3.1",
"payload": "^1.8.2"
},
"devDependencies": {

View File

@ -1,5 +1,4 @@
import { CollectionConfig } from "payload/types";
import fetch from "node-fetch";
const Posts: CollectionConfig = {
slug: "posts",
admin: {
@ -14,18 +13,23 @@ const Posts: CollectionConfig = {
hooks: {
afterChange: [
async () => {
console.log("HALLO");
try {
await fetch("https://api.github.com/repos/mooxl/astroad/dispatches", {
method: "POST",
headers: {
Accept: "application/vnd.github.everest-preview+json",
Authorization: "token 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",
},
body: JSON.stringify({
event_type: "payload_update",
}),
});
console.log(
await fetch(
"https://api.github.com/repos/mooxl/astroad/dispatches",
{
method: "POST",
headers: {
Accept: "application/vnd.github.everest-preview+json",
Authorization:
"token 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",
},
body: JSON.stringify({
event_type: "payload_update",
}),
}
)
);
} catch (e) {
console.log(e);
}