fix typo,
This commit is contained in:
@@ -11,15 +11,39 @@ import {
|
|||||||
IonRouterLink,
|
IonRouterLink,
|
||||||
IonRow,
|
IonRow,
|
||||||
IonToolbar,
|
IonToolbar,
|
||||||
|
useIonRouter,
|
||||||
} from '@ionic/react';
|
} from '@ionic/react';
|
||||||
// import { Action } from '../components/Action';
|
// import { Action } from '../components/Action';
|
||||||
import styles from './style.module.scss';
|
import styles from './style.module.scss';
|
||||||
import { Action } from '../../../components/Action';
|
import { Action } from '../../../components/Action';
|
||||||
import { Paths } from '../../../Paths';
|
import { Paths } from '../../../Paths';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useUser } from '../../../hooks/use-user';
|
||||||
|
|
||||||
const AuthHome = () => {
|
const AuthHome = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { user } = useUser();
|
||||||
|
const router = useIonRouter();
|
||||||
|
|
||||||
|
const [showLoading, setShowLoading] = useState<boolean>(true);
|
||||||
|
const [showError, setShowErrr] = useState<{ show: boolean; message: string }>({
|
||||||
|
show: false,
|
||||||
|
message: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!user) {
|
||||||
|
} else {
|
||||||
|
if (user?.id) {
|
||||||
|
router.push(Paths.AuthorizedTest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setShowLoading(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (showLoading) return <>loading</>;
|
||||||
|
if (showError) return <>{showError.message}</>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IonPage className={'styles.homePage'}>
|
<IonPage className={'styles.homePage'}>
|
||||||
|
Reference in New Issue
Block a user