1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

fix handling after internal login

This commit is contained in:
Sylvain 2021-06-25 11:10:17 +02:00
parent c0211cd002
commit 99bd00949e

View File

@ -36,10 +36,6 @@ const ReserveButtonComponent: React.FC<ReserveButtonProps> = ({ currentUser, mac
// handle login from an external process
useEffect(() => setUser(currentUser), [currentUser]);
// refresh the machine after the user has logged
useEffect(() => {
if (user !== currentUser) getMachine();
}, [user]);
// check the trainings after we retrieved the machine data
useEffect(() => checkTraining(), [machine]);
@ -92,7 +88,7 @@ const ReserveButtonComponent: React.FC<ReserveButtonProps> = ({ currentUser, mac
// if there's no user currently logged, trigger the logging process
if (!user) {
onLoginRequested()
.then(user => setUser(user))
.then(() => getMachine())
.catch(error => onError(error));
return;
}