Merge branch 'mhmfajar-dev' into mhmfajar
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { capitalCase } from 'change-case';
|
||||
// @mui
|
||||
import { styled } from '@mui/material/styles';
|
||||
import { Box, Card, Divider, Grid, Link, Stack, Tooltip, Typography } from '@mui/material';
|
||||
// hooks
|
||||
import useAuth from '../../hooks/useAuth';
|
||||
import { Box, Card, Divider, Grid, Link, Stack, Typography } from '@mui/material';
|
||||
// components
|
||||
import Page from '../../components/Page';
|
||||
import Image from '../../components/Image';
|
||||
@@ -36,10 +33,8 @@ const ContentStyle = styled(Card)(({ theme }) => ({
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export default function Login() {
|
||||
const { method } = useAuth();
|
||||
const location = useLocation();
|
||||
const { state } = useLocation();
|
||||
const [formPhone, setFormPhone] = useState(false);
|
||||
// const { setForm } = location.state;
|
||||
|
||||
const handlerChange = (event: any, setForm: boolean) => {
|
||||
event.preventDefault();
|
||||
@@ -47,9 +42,11 @@ export default function Login() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log('setForm');
|
||||
// setFormPhone(setForm ? setForm : true);
|
||||
}, []);
|
||||
if (state !== null) {
|
||||
setFormPhone(state.formPhone);
|
||||
}
|
||||
console.log(state);
|
||||
}, [state]);
|
||||
|
||||
return (
|
||||
<Page title="Login">
|
||||
@@ -61,10 +58,7 @@ export default function Login() {
|
||||
</Grid>
|
||||
<Grid item xs={6} sx={{ padding: 3 }}>
|
||||
<Stack direction="row" alignItems="center" sx={{ mb: 5 }}>
|
||||
<Tooltip title={capitalCase(method)} placement="left">
|
||||
<Logo sx={{ width: 90, height: 90 }} />
|
||||
</Tooltip>
|
||||
|
||||
<Logo sx={{ width: 90, height: 90 }} />
|
||||
<Box sx={{ flexGrow: 1 }}>
|
||||
<Typography variant="h4" gutterBottom>
|
||||
Sign in to LinkSehat
|
||||
@@ -75,29 +69,31 @@ export default function Login() {
|
||||
</Box>
|
||||
</Stack>
|
||||
|
||||
{formPhone === false ? <LoginEmailForm /> : <LoginPhoneForm />}
|
||||
{formPhone ? (
|
||||
<LoginPhoneForm formPhone={formPhone} />
|
||||
) : (
|
||||
<LoginEmailForm formPhone={formPhone} />
|
||||
)}
|
||||
|
||||
<Divider sx={{ marginTop: 5 }}>Atau</Divider>
|
||||
|
||||
<Stack sx={{ marginTop: 5 }}>
|
||||
{formPhone === false ? (
|
||||
{formPhone ? (
|
||||
<Link
|
||||
href=""
|
||||
align="center"
|
||||
underline="hover"
|
||||
onClick={(event) => handlerChange(event, true)}
|
||||
>
|
||||
Masuk menggunakan nomor handphone
|
||||
</Link>
|
||||
) : (
|
||||
<Link
|
||||
href=""
|
||||
align="center"
|
||||
underline="hover"
|
||||
onClick={(event) => handlerChange(event, false)}
|
||||
>
|
||||
Masuk menggunakan email
|
||||
</Link>
|
||||
) : (
|
||||
<Link
|
||||
align="center"
|
||||
underline="hover"
|
||||
onClick={(event) => handlerChange(event, true)}
|
||||
>
|
||||
Masuk menggunakan nomor handphone
|
||||
</Link>
|
||||
)}
|
||||
</Stack>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user