Skip to content

Commit

Permalink
feat(logrocket): ✨ Add user info to LogRocket session tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
n8io committed May 29, 2020
1 parent eb2ca29 commit 3e16eb5
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useApolloClient } from '@apollo/client';
import { SplitClient } from '@splitsoftware/splitio-react';
import jwtDecode from 'jwt-decode';
import LogRocket from 'logrocket';
import { node } from 'prop-types';
import React, { useCallback, useState } from 'react';
import React, { useCallback, useState, useEffect } from 'react';
import { useUserLogout } from 'shared/graphql';
import { AccessToken } from 'types/accessToken';
import { Jwt } from 'types/jwt';
Expand Down Expand Up @@ -34,6 +35,12 @@ const Auth = ({ children }) => {
[setUser]
);

useEffect(() => {
if (!user) return;

LogRocket.identify(user.id, user);
}, [user]);

const authContext = {
isAuthenticated: Boolean(user),
logout,
Expand Down

0 comments on commit 3e16eb5

Please sign in to comment.