```
add user profile navigation logic and update button in SettingContainer ```
This commit is contained in:
@@ -3,6 +3,7 @@ import { arrowBack } from 'ionicons/icons';
|
||||
import { LESSON_LINK, VERSIONS } from '../../constants';
|
||||
import SettingSvg from './image.svg';
|
||||
import { Paths } from '../../Paths';
|
||||
import { pb } from '../../lib/pb';
|
||||
|
||||
interface ContainerProps {
|
||||
name: string;
|
||||
@@ -15,6 +16,14 @@ const SettingContainer: React.FC<ContainerProps> = ({ name }) => {
|
||||
router.push(Paths.AuthHome);
|
||||
}
|
||||
|
||||
function handleUserProfileClick() {
|
||||
if (pb.authStore.record?.id) {
|
||||
router.push(Paths.GetStudentInfoLink(pb.authStore.record.id));
|
||||
} else {
|
||||
router.push(Paths.AuthLogin);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
@@ -40,7 +49,7 @@ const SettingContainer: React.FC<ContainerProps> = ({ name }) => {
|
||||
<p>T.B.A.</p>
|
||||
</div>
|
||||
<div>{VERSIONS}</div>
|
||||
<IonButton onClick={handleAuthHomeClick}>AuthHome</IonButton>
|
||||
<IonButton onClick={handleUserProfileClick}>User Profile</IonButton>
|
||||
<IonButton
|
||||
onClick={() => {
|
||||
router.push(LESSON_LINK, undefined, 'replace');
|
||||
|
Reference in New Issue
Block a user