completionId: cgen-2f8c4bf780ef468696b51822ba5f99cf
cgen-2f8c4bf780ef468696b51822ba5f99cf
This commit is contained in:
parent
0e3bda5de6
commit
0476dc5fae
1 changed files with 27 additions and 0 deletions
|
|
@ -112,6 +112,33 @@ export default async function handler(req: any, res: any) {
|
||||||
|
|
||||||
const createdPost = data?.[0];
|
const createdPost = data?.[0];
|
||||||
|
|
||||||
|
// Sync post to Discord feed webhook
|
||||||
|
try {
|
||||||
|
const apiBase = process.env.API_BASE || "/api";
|
||||||
|
await fetch(`${apiBase}/discord/feed-sync`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: createdPost?.id,
|
||||||
|
title: createdPost?.title,
|
||||||
|
content: createdPost?.content,
|
||||||
|
author_name:
|
||||||
|
createdPost?.user_profiles?.full_name ||
|
||||||
|
createdPost?.user_profiles?.username ||
|
||||||
|
"Community member",
|
||||||
|
author_avatar: createdPost?.user_profiles?.avatar_url,
|
||||||
|
arm_affiliation: createdPost?.arm_affiliation,
|
||||||
|
likes_count: createdPost?.likes_count,
|
||||||
|
comments_count: createdPost?.comments_count,
|
||||||
|
created_at: createdPost?.created_at,
|
||||||
|
}),
|
||||||
|
}).catch((err) =>
|
||||||
|
console.error("[Posts API] Discord sync error:", err),
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("[Posts API] Failed to sync to Discord:", error);
|
||||||
|
}
|
||||||
|
|
||||||
// Publish activity event for post creation
|
// Publish activity event for post creation
|
||||||
try {
|
try {
|
||||||
const apiBase = process.env.API_BASE || "/api";
|
const apiBase = process.env.API_BASE || "/api";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue