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();
|
const history = useHistory();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const createGuestAccount = async () => {
|
if (!getStoredAuthToken()) {
|
||||||
|
const createGuestAccount = async () => {
|
||||||
try {
|
try {
|
||||||
const { authToken } = await api.post('/authentication/guest');
|
const { authToken } = await api.post('/authentication/guest');
|
||||||
storeAuthToken(authToken);
|
storeAuthToken(authToken);
|
||||||
@@ -19,8 +20,6 @@ const Authenticate = () => {
|
|||||||
toast.error(error);
|
toast.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!getStoredAuthToken()) {
|
|
||||||
createGuestAccount();
|
createGuestAccount();
|
||||||
}
|
}
|
||||||
}, [history]);
|
}, [history]);
|
||||||
|
|||||||
Reference in New Issue
Block a user