Skip to content
Snippets Groups Projects
Commit 3798ba39 authored by Rémi PAILHAREY's avatar Rémi PAILHAREY :fork_knife_plate:
Browse files

Revert "feat(useFindUser): catch errors on /WhoAmI calls"

This reverts commit 4379e727
parent 4379e727
No related branches found
No related tags found
2 merge requests!24fix(typo): écogestes + optionnel poll,!22feat: Add partners issue info
Pipeline #17156 failed
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import axios from 'axios' import axios from 'axios'
import { User } from '../models/user.model' import { User } from '../models/user.model'
import { toast } from 'react-toastify'
const useFindUser = () => { const useFindUser = () => {
const [user, setUser] = useState<User | null>(null) const [user, setUser] = useState<User | null>(null)
...@@ -9,14 +8,10 @@ const useFindUser = () => { ...@@ -9,14 +8,10 @@ const useFindUser = () => {
useEffect(() => { useEffect(() => {
async function findUser() { async function findUser() {
try { const { data } = await axios.get(`/api/common/WhoAmI`)
const { data } = await axios.get(`/api/common/WhoAmI`) if (data) {
if (data) { setUser(data)
setUser(data) setLoading(false)
setLoading(false)
}
} catch (error) {
toast.error('Access denied, please login')
} }
} }
findUser() findUser()
......
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