heya
Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
parent
ef3b65b1c0
commit
a321c27376
@ -16,7 +16,6 @@
|
|||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"node-fetch": "^3.3.1",
|
|
||||||
"payload": "^1.8.2"
|
"payload": "^1.8.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { CollectionConfig } from "payload/types";
|
import { CollectionConfig } from "payload/types";
|
||||||
import fetch from "node-fetch";
|
|
||||||
const Posts: CollectionConfig = {
|
const Posts: CollectionConfig = {
|
||||||
slug: "posts",
|
slug: "posts",
|
||||||
admin: {
|
admin: {
|
||||||
@ -14,18 +13,23 @@ const Posts: CollectionConfig = {
|
|||||||
hooks: {
|
hooks: {
|
||||||
afterChange: [
|
afterChange: [
|
||||||
async () => {
|
async () => {
|
||||||
console.log("HALLO");
|
|
||||||
try {
|
try {
|
||||||
await fetch("https://api.github.com/repos/mooxl/astroad/dispatches", {
|
console.log(
|
||||||
method: "POST",
|
await fetch(
|
||||||
headers: {
|
"https://api.github.com/repos/mooxl/astroad/dispatches",
|
||||||
Accept: "application/vnd.github.everest-preview+json",
|
{
|
||||||
Authorization: "token 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",
|
method: "POST",
|
||||||
},
|
headers: {
|
||||||
body: JSON.stringify({
|
Accept: "application/vnd.github.everest-preview+json",
|
||||||
event_type: "payload_update",
|
Authorization:
|
||||||
}),
|
"token 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",
|
||||||
});
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
event_type: "payload_update",
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user