Merge branch 'login_default_entry_removal' of FloatSystems/float-users into master

This commit is contained in:
2023-04-14 21:19:15 +00:00
committed by Gogs
2 changed files with 9 additions and 8 deletions
+2 -4
View File
@@ -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')
+7 -4
View File
@@ -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)