default login values removed
This commit is contained in:
@@ -23,8 +23,8 @@ const loginSchema = Yup.object().shape({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
email: 'demo@float.sg',
|
email: '',
|
||||||
password: '****',
|
password: '',
|
||||||
}
|
}
|
||||||
//email: 'admin@demo.com',
|
//email: 'admin@demo.com',
|
||||||
/*
|
/*
|
||||||
@@ -45,10 +45,8 @@ export function Login() {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
try {
|
try {
|
||||||
const {data: auth} = await login(values.email, values.password)
|
const {data: auth} = await login(values.email, values.password)
|
||||||
console.log('yes')
|
|
||||||
saveAuth(auth)
|
saveAuth(auth)
|
||||||
// const {data: user} = await getUserByToken(auth.session_token)
|
// const {data: user} = await getUserByToken(auth.session_token)
|
||||||
console.log('yes2')
|
|
||||||
// setCurrentUser(user)
|
// setCurrentUser(user)
|
||||||
setCurrentUser(auth.profile)
|
setCurrentUser(auth.profile)
|
||||||
navigate('/dashboard')
|
navigate('/dashboard')
|
||||||
|
|||||||
@@ -69,9 +69,12 @@ 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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user