diff --git a/src/app/modules/auth/components/Login.tsx b/src/app/modules/auth/components/Login.tsx index b0da5d8..16b701c 100644 --- a/src/app/modules/auth/components/Login.tsx +++ b/src/app/modules/auth/components/Login.tsx @@ -23,8 +23,8 @@ const loginSchema = Yup.object().shape({ }) const initialValues = { - email: 'demo@float.sg', - password: '****', + email: '', + password: '', } //email: 'admin@demo.com', /* @@ -45,10 +45,8 @@ export function Login() { setLoading(true) try { const {data: auth} = await login(values.email, values.password) - console.log('yes') saveAuth(auth) // const {data: user} = await getUserByToken(auth.session_token) - console.log('yes2') // setCurrentUser(user) setCurrentUser(auth.profile) navigate('/dashboard') diff --git a/src/app/modules/auth/core/Auth.tsx b/src/app/modules/auth/core/Auth.tsx index 1c2f052..b95b0db 100644 --- a/src/app/modules/auth/core/Auth.tsx +++ b/src/app/modules/auth/core/Auth.tsx @@ -69,9 +69,12 @@ const AuthInit: FC = ({children}) => { const requestUser = async (apiToken: string) => { try { if (!didRequest.current) { - const {data} = await getUserByToken(apiToken) - if (data) { - setCurrentUser(data) + // const {data} = await getUserByToken(apiToken) + // if (data) { + // setCurrentUser(data) + // } + if (localStorage.getItem('kt-auth-react-v')) { + setCurrentUser(auth.profile) } } } catch (error) {