Send username/id to Sentry

This commit is contained in:
Alex Gleason
2023-10-12 20:07:48 -05:00
parent 2cdfaf4871
commit a98dfd8c11
2 changed files with 23 additions and 5 deletions

View File

@ -1,3 +1,5 @@
import type { Account } from './schemas';
/** Start Sentry. */
async function startSentry(dsn: string): Promise<void> {
const [Sentry, { Integrations: Integrations }] = await Promise.all([
@ -36,4 +38,14 @@ async function startSentry(dsn: string): Promise<void> {
});
}
export { startSentry };
/** Associate the account with Sentry events. */
async function setSentryAccount(account: Account) {
const Sentry = await import('@sentry/react');
Sentry.setUser({
id: account.id,
username: account.acct,
});
}
export { startSentry, setSentryAccount };