Tabs agora aparecem somente para usuários logados
This commit is contained in:
@@ -5,7 +5,7 @@ import { useEffect, useState } from 'react';
|
||||
import { useHistory, useParams } from 'react-router';
|
||||
import './Cadastro.css';
|
||||
import ModalExample from '../../components/Email';
|
||||
import * as UsersService from '../../services/users'
|
||||
import * as UsersService from '../../services/api/users'
|
||||
|
||||
const Cadastro: React.FC = () => {
|
||||
const history = useHistory();
|
||||
@@ -114,7 +114,7 @@ const Cadastro: React.FC = () => {
|
||||
<IonHeader>
|
||||
<IonToolbar>
|
||||
<IonButtons slot="start">
|
||||
<IonBackButton text={''} icon={arrowBack} defaultHref='mainpages' />
|
||||
<IonBackButton text={''} icon={arrowBack} defaultHref='login' />
|
||||
</IonButtons>
|
||||
</IonToolbar>
|
||||
</IonHeader>
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
IonTitle,
|
||||
IonToolbar
|
||||
} from "@ionic/react";
|
||||
import React, { useState } from "react";
|
||||
import React, { useContext, useState } from "react";
|
||||
import { IonGrid, IonRow, IonCol, IonToast } from "@ionic/react";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import {
|
||||
@@ -15,9 +15,10 @@ import {
|
||||
IonButton,
|
||||
} from "@ionic/react";
|
||||
|
||||
import * as sessionRoutes from '../services/session';
|
||||
import * as sessionRoutes from '../services/api/session';
|
||||
import LocalStorage from '../LocalStorage';
|
||||
import { Action } from "../components/Action";
|
||||
import { UserContext } from "../App";
|
||||
|
||||
const Page: React.FC = () => {
|
||||
const [showToast, setShowToast] = useState(false);
|
||||
@@ -27,6 +28,8 @@ const Page: React.FC = () => {
|
||||
const [email, setEmail] = useState<string>("matheusalb3213@gmail.com");
|
||||
const [password, setPassword] = useState<string>("12345678");
|
||||
|
||||
const user = useContext(UserContext);
|
||||
|
||||
function validateEmail(email: string) {
|
||||
const re =
|
||||
// eslint-disable-next-line no-control-regex
|
||||
@@ -84,6 +87,8 @@ const Page: React.FC = () => {
|
||||
|
||||
LocalStorage.setToken(token);
|
||||
|
||||
user.setIsLoggedIn(true);
|
||||
|
||||
history.push({ pathname: '/home' });
|
||||
}).catch(error => {
|
||||
// if (!error.response) return
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
#avatar {
|
||||
border-radius: 50%;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
IonIcon {
|
||||
color: blue;
|
||||
}
|
||||
@@ -3,11 +3,17 @@ import {
|
||||
IonCardContent,
|
||||
IonCardHeader,
|
||||
IonCardTitle,
|
||||
IonChip,
|
||||
IonContent,
|
||||
IonFab,
|
||||
IonFabButton,
|
||||
IonGrid,
|
||||
IonHeader,
|
||||
IonIcon,
|
||||
IonItem,
|
||||
IonLabel,
|
||||
IonList,
|
||||
IonListHeader,
|
||||
IonPage,
|
||||
IonTitle,
|
||||
IonToast,
|
||||
@@ -18,8 +24,8 @@ import React, { useState, useEffect, useReducer } from "react";
|
||||
import { IonRow, IonCol } from "@ionic/react";
|
||||
import { createOutline } from "ionicons/icons";
|
||||
|
||||
import * as sessionRoutes from '../services/session';
|
||||
import * as usersRoutes from '../services/users';
|
||||
import * as sessionRoutes from '../services/api/session';
|
||||
import * as usersRoutes from '../services/api/users';
|
||||
|
||||
import './Perfil.css'
|
||||
import LocalStorage from "../LocalStorage";
|
||||
@@ -137,6 +143,32 @@ const Perfil: React.FC = () => {
|
||||
</IonCardContent>
|
||||
</IonCard>
|
||||
|
||||
<IonCard>
|
||||
<IonCardContent>
|
||||
<IonLabel>Status do perfil</IonLabel>
|
||||
<IonChip>
|
||||
<IonLabel color="primary">Passageiro</IonLabel>
|
||||
</IonChip>
|
||||
</IonCardContent>
|
||||
</IonCard>
|
||||
|
||||
<IonList>
|
||||
<IonListHeader>Dashboard</IonListHeader>
|
||||
<IonItem>
|
||||
<IonIcon></IonIcon>
|
||||
<IonLabel>Confirmar perfil</IonLabel>
|
||||
</IonItem>
|
||||
<IonItem>
|
||||
<IonLabel>Cadastrar Van</IonLabel>
|
||||
</IonItem>
|
||||
<IonItem>
|
||||
<IonLabel>Pagamentos</IonLabel>
|
||||
</IonItem>
|
||||
<IonItem>
|
||||
<IonLabel>Avaliações</IonLabel>
|
||||
</IonItem>
|
||||
</IonList>
|
||||
|
||||
<IonFab vertical="bottom" horizontal="end" slot="fixed">
|
||||
<IonFabButton onClick={() => history.push({ pathname: '/perfil/editar', state: { userData: inputValues } })}>
|
||||
<IonIcon icon={createOutline} />
|
||||
|
||||
@@ -25,7 +25,7 @@ import { saveOutline } from "ionicons/icons";
|
||||
|
||||
import isEqual from 'lodash.isequal';
|
||||
|
||||
import * as usersRoutes from '../services/users';
|
||||
import * as usersRoutes from '../services/api/users';
|
||||
|
||||
import './Cadastro/Cadastro.css'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user