Skip to content

Commit

Permalink
Merge pull request #229 from n8io/n8io/ch37/add-authenticated-user-tr…
Browse files Browse the repository at this point in the history
…acking-to-logrocket
  • Loading branch information
n8io authored May 29, 2020
2 parents eb2ca29 + 3e16eb5 commit bec8914
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 bec8914

Please sign in to comment.