Skip to content
Snippets Groups Projects
Verified Commit a59bd356 authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Corrected mount action which was causing infinite loop.

parent e8f5de30
No related branches found
No related tags found
2 merge requests!56Refined auth flow and new website pages.,!45Polished auth flow including ReservedRoute and role selection.
...@@ -31,7 +31,7 @@ export const App: FC = () => { ...@@ -31,7 +31,7 @@ export const App: FC = () => {
// Initialize asking the server if this session is already logged in. // Initialize asking the server if this session is already logged in.
isAuthenticated().then((responseState) => setIsAuth(responseState)); isAuthenticated().then((responseState) => setIsAuth(responseState));
getRole().then((responseRole) => setRole(responseRole)); getRole().then((responseRole) => setRole(responseRole));
}, [isAuth, role]); }, []);
return ( return (
<div data-testid="App"> <div data-testid="App">
......
...@@ -28,7 +28,7 @@ export const SignInForm: FC = () => { ...@@ -28,7 +28,7 @@ export const SignInForm: FC = () => {
return () => { return () => {
isMounted = false; isMounted = false;
}; };
}, [cookie]); }, []);
const { control, errors, setError, handleSubmit } = useForm<CredentialsType>({ const { control, errors, setError, handleSubmit } = useForm<CredentialsType>({
defaultValues, defaultValues,
...@@ -52,6 +52,7 @@ export const SignInForm: FC = () => { ...@@ -52,6 +52,7 @@ export const SignInForm: FC = () => {
}, },
) )
.then((response) => { .then((response) => {
console.log(response);
if (response.data.status === 'fail') { if (response.data.status === 'fail') {
setError('username', { setError('username', {
type: 'server', type: 'server',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment