From 3798ba39255942bfc21a89cffdd20ea57f37123c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20PAILHAREY?= <rpailharey@grandlyon.com>
Date: Thu, 28 Oct 2021 13:52:14 +0000
Subject: [PATCH] Revert "feat(useFindUser): catch errors on /WhoAmI calls"

This reverts commit 4379e727743efb97181af48efcb27e09a674920a
---
 src/hooks/useFindUser.ts | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/hooks/useFindUser.ts b/src/hooks/useFindUser.ts
index b76d2a11..3c853bca 100644
--- a/src/hooks/useFindUser.ts
+++ b/src/hooks/useFindUser.ts
@@ -1,7 +1,6 @@
 import { useState, useEffect } from 'react'
 import axios from 'axios'
 import { User } from '../models/user.model'
-import { toast } from 'react-toastify'
 
 const useFindUser = () => {
   const [user, setUser] = useState<User | null>(null)
@@ -9,14 +8,10 @@ const useFindUser = () => {
 
   useEffect(() => {
     async function findUser() {
-      try {
-        const { data } = await axios.get(`/api/common/WhoAmI`)
-        if (data) {
-          setUser(data)
-          setLoading(false)
-        }
-      } catch (error) {
-        toast.error('Access denied, please login')
+      const { data } = await axios.get(`/api/common/WhoAmI`)
+      if (data) {
+        setUser(data)
+        setLoading(false)
       }
     }
     findUser()
-- 
GitLab