mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-14 00:32:35 +10:00
set sentry user ID, if available and applicable
This commit is contained in:
17
client/wrappers/SentryWrapper.tsx
Normal file
17
client/wrappers/SentryWrapper.tsx
Normal file
@ -0,0 +1,17 @@
|
||||
import * as Sentry from '@sentry/nextjs';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { useAppSelector } from '@/store/hooks';
|
||||
|
||||
const SentryWrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
|
||||
const user = useAppSelector((state) => state.auth.user);
|
||||
|
||||
useEffect(() => {
|
||||
const sentryUser: Sentry.User | null = user && { ...user, id: user?.id.toString() };
|
||||
Sentry.setUser(sentryUser);
|
||||
}, [user]);
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
export default SentryWrapper;
|
||||
Reference in New Issue
Block a user