Improve effect
There is no need to create function each time when history changes and do not use it.
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user