Skip to content

Commit

Permalink
Make call to sentry on general feedback submission
Browse files Browse the repository at this point in the history
  • Loading branch information
thostetler committed Dec 19, 2024
1 parent 17dc715 commit a4efb09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ Sentry.init({
Sentry.browserTracingIntegration({
enableInp: true,
}),
Sentry.feedbackIntegration(),
],
});
16 changes: 15 additions & 1 deletion src/pages/feedback/general.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
import {
AlertStatus,
Button,
Expand All @@ -13,6 +12,7 @@ import {
Textarea,
useDisclosure,
} from '@chakra-ui/react';
import * as Sentry from '@sentry/nextjs';

import { zodResolver } from '@hookform/resolvers/zod';
import { useStore } from '@/store';
Expand Down Expand Up @@ -41,6 +41,7 @@ import { useGetUserEmail } from '@/lib/useGetUserEmail';
import { makeSearchParams } from '@/utils/common/search';
import { parseAPIError } from '@/utils/common/parseAPIError';
import { useFeedback } from '@/api/feedback/feedback';
import { logger } from '@/logger';

type FormValues = {
name: string;
Expand Down Expand Up @@ -148,6 +149,19 @@ const General: NextPage = () => {
},
},
);

try {
const eventId = Sentry.captureMessage('Feedback submitted');
const feedback = {
name,
email: userEmail ?? 'anonymous',
message: comments,
associatedEventId: eventId,
};
Sentry.captureFeedback(feedback);
} catch {
logger.error('Failed to send feedback to analytics');
}
} catch (e) {
setFormError(e as Error);
}
Expand Down

0 comments on commit a4efb09

Please sign in to comment.