fleet login implementation #5
@@ -69,15 +69,18 @@ const AuthInit: FC<WithChildren> = ({children}) => {
|
|||||||
const requestUser = async (apiToken: string) => {
|
const requestUser = async (apiToken: string) => {
|
||||||
try {
|
try {
|
||||||
if (!didRequest.current) {
|
if (!didRequest.current) {
|
||||||
const {data} = await getUserByToken(apiToken)
|
// const {data} = await getUserByToken(apiToken)
|
||||||
if (data) {
|
// if (data) {
|
||||||
setCurrentUser(data)
|
// setCurrentUser(data)
|
||||||
|
// }
|
||||||
|
if(localStorage.getItem('kt-auth-react-v')){
|
||||||
|
setCurrentUser(auth?.profile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
if (!didRequest.current) {
|
if (!didRequest.current) {
|
||||||
// logout()
|
logout()
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
setShowSplashScreen(false)
|
setShowSplashScreen(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user