Merge branch 'login_default_entry_removal' of FloatSystems/float-users into master
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -69,15 +69,18 @@ const AuthInit: FC<WithChildren> = ({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) {
|
||||
console.error(error)
|
||||
if (!didRequest.current) {
|
||||
// logout()
|
||||
logout()
|
||||
}
|
||||
} finally {
|
||||
setShowSplashScreen(false)
|
||||
|
||||
Reference in New Issue
Block a user