From 1dfdfb1a452ea2eaa33973830ba224b37cda30b9 Mon Sep 17 00:00:00 2001
From: Alberto Defendi <1369-ahl-berto@users.noreply.gitlab.inf.unibz.it>
Date: Thu, 27 May 2021 14:35:42 +0200
Subject: [PATCH] Set null when server not called.

---
 src/hooks/useAuth.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/hooks/useAuth.ts b/src/hooks/useAuth.ts
index 0479313..10236cb 100644
--- a/src/hooks/useAuth.ts
+++ b/src/hooks/useAuth.ts
@@ -8,11 +8,11 @@ import { useEffect, useState } from 'react';
  * @returns {boolean | null} isAuth: true if user is authenticated, false otherwise or null if the request has not finished.
  */
 export const useAuth = (): [
-  boolean,
-  React.Dispatch<React.SetStateAction<boolean>>,
+  boolean | null,
+  React.Dispatch<React.SetStateAction<boolean | null>>,
 ] => {
   let isMounted = true;
-  const [isAuth, setIsAuth] = useState<boolean>(false);
+  const [isAuth, setIsAuth] = useState<boolean | null>(null);
   useEffect(() => {
     isAuthenticated().then((state) => {
       if (isMounted) {
-- 
GitLab