Add description to reportEvent function

This commit is contained in:
Kiran K 2023-11-24 12:09:15 +05:30
parent 1867c6e7f7
commit aa9562a473
2 changed files with 5 additions and 2 deletions

View File

@ -33,7 +33,7 @@ const getClient = async () => {
};
// Send an event to Retraced
const reportEvent = async ({ action, crud, group, actor, productId }: ReportEventParams) => {
const reportEvent = async ({ action, crud, group, actor, description, productId }: ReportEventParams) => {
try {
const retracedClient = await getClient();
@ -52,6 +52,8 @@ const reportEvent = async ({ action, crud, group, actor, productId }: ReportEven
crud,
group,
actor,
description,
created: new Date(),
};
// Find team info for the product
@ -64,7 +66,7 @@ const reportEvent = async ({ action, crud, group, actor, productId }: ReportEven
name: productInfo.teamName,
};
} catch (err: any) {
console.error('Error getting product info', err);
console.error('Error getting product info. Event not reported to Retraced.', err);
}
}

View File

@ -35,6 +35,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
id: profile.email,
name: `${profile.firstName} ${profile.lastName}`,
},
description: `User ${profile.email} logged in via SSO`,
productId: profile.requested.product,
});