diff --git a/client/src/Auth/Authenticate.jsx b/client/src/Auth/Authenticate.jsx index cf22672..67ff7d0 100644 --- a/client/src/Auth/Authenticate.jsx +++ b/client/src/Auth/Authenticate.jsx @@ -10,7 +10,8 @@ const Authenticate = () => { const history = useHistory(); useEffect(() => { - const createGuestAccount = async () => { + if (!getStoredAuthToken()) { + const createGuestAccount = async () => { try { const { authToken } = await api.post('/authentication/guest'); storeAuthToken(authToken); @@ -19,8 +20,6 @@ const Authenticate = () => { toast.error(error); } }; - - if (!getStoredAuthToken()) { createGuestAccount(); } }, [history]);