Skip to content

Commit

Permalink
mudança nos links de requests para conectar com heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
caducatrinck committed May 17, 2021
1 parent 2de89c0 commit bb5187c
Show file tree
Hide file tree
Showing 5 changed files with 382 additions and 325 deletions.
2 changes: 1 addition & 1 deletion src/components/CadastroCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function CadastroCard() {
'login',
async () => {
const response = await fetch(
'http://localhost:3000/login/cadastro',
'http://mil-challenge.herokuapp.com/login/cadastro',
{
method: 'POST',
headers: {
Expand Down
227 changes: 125 additions & 102 deletions src/components/CardHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,124 +3,147 @@ import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import {
Button,
createStyles,
FormControl,
Theme,
Typography,
Button,
createStyles,
FormControl,
Theme,
Typography,
} from '@material-ui/core';
import { useHistory } from 'react-router-dom';
import { useEstilos } from './Style/useEstilos';
import { useQuery } from 'react-query';




const useStyles = makeStyles((theme: Theme) =>
createStyles({
logo: {
width: 160,
paddingTop: 15,
paddingBottom: 50,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
subHeading: {
color: '#616161',
textTransform: 'none',
paddingBottom: 10,
},
description: {
lineHeight: 1.9,
minHeight: '250px',
maxHeight: '250px',
color: '#616161',
},
ipShow: {
textTransform: 'none',
fontSize: 12,
lineHeight: 1.9,
color: '#e1e1e1',
},
padding: {
paddingBottom: 11,
paddingTop: 11,
paddingLeft: 30,
paddingRight: 30,
},
loggoutButton: {
'&:hover': {
background: 'none',
},
color: '#EB5757',
fontSize: '15px',
display: 'flex',
justifyContent: 'flex-end',
},
centerFooter: {
display: 'flex',
alignItems: 'baseline',
paddingTop: '110px',
justifyContent: 'space-between',
},
})
createStyles({
logo: {
width: 160,
paddingTop: 15,
paddingBottom: 50,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
subHeading: {
color: '#616161',
textTransform: 'none',
paddingBottom: 10,
},
description: {
lineHeight: 1.9,
minHeight: '250px',
maxHeight: '250px',
color: '#616161',
},
ipShow: {
textTransform: 'none',
fontSize: 12,
lineHeight: 1.9,
color: '#e1e1e1',
},
padding: {
paddingBottom: 11,
paddingTop: 11,
paddingLeft: 30,
paddingRight: 30,
},
loggoutButton: {
'&:hover': {
background: 'none',
},
color: '#EB5757',
fontSize: '15px',
display: 'flex',
justifyContent: 'flex-end',
},
centerFooter: {
display: 'flex',
alignItems: 'baseline',
paddingTop: '110px',
justifyContent: 'space-between',
},
})
);

export function CardHome() {
let history = useHistory();
const classes = useStyles();
const estilo = useEstilos();
let history = useHistory();
const classes = useStyles();
const estilo = useEstilos();
const token = localStorage.getItem('token');


const { data, error, isLoading } = useQuery(
'homepage',
async () => {
const response = await fetch(
'http://mil-challenge.herokuapp.com/login/home',
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
}
);
return response.json()
}
);


function ClickLogoff() {
localStorage.removeItem('token');
history.push('/');
}
function ClickLogoff() {
localStorage.removeItem('token');
history.push('/login');
}

return (
<Card className={estilo.cardStyle}>
<CardContent>
<FormControl className={classes.padding} variant="filled">
<div className={estilo.centerLogo}>
<img
src="/medsenior.png"
alt="logo"
className={classes.logo}
/>
</div>
<Typography variant="h6" className={estilo.heading}>
Bem Vindo!
return (
<Card className={estilo.cardStyle}>
<CardContent>
<FormControl className={classes.padding} variant="filled">
<div className={estilo.centerLogo}>
<img
src="/medsenior.png"
alt="logo"
className={classes.logo}
/>
</div>
<Typography variant="h6" className={estilo.heading}>
Bem Vindo!
</Typography>

<Typography className={classes.subHeading}>
Agora você é um filiado!
<Typography className={classes.subHeading}>
Agora você é um filiado!
</Typography>

<Typography
className={classes.description}
variant="caption">
An vis noster integre. Ius alterum ornatus ad, et his quod
luptatum. Pri ne magna aeque omnes, an eam urbanitas
assentior comprehensam, iusto commodo maluisset ei mei!
Harum argumentum an sed, vis ne nibh facete
necessitatibus, verear epicuri moderatius et sit. Vel
vitae tation et, omnes nostrum facilisi vis id. Cum semper
sensibus cu, corpora quaerendum te duo. Affert fastidii ad
ius, mei ancillae volutpat splendide at, etiam noluisse
adipiscing an vel. Te euismod definiebas percipitur eam,
an nam deleniti appetere voluptatibus. Affert fastidii ad
ius.An vis noster integre.
<Typography
className={classes.description}
variant="caption">
An vis noster integre. Ius alterum ornatus ad, et his quod
luptatum. Pri ne magna aeque omnes, an eam urbanitas
assentior comprehensam, iusto commodo maluisset ei mei!
Harum argumentum an sed, vis ne nibh facete
necessitatibus, verear epicuri moderatius et sit. Vel
vitae tation et, omnes nostrum facilisi vis id. Cum semper
sensibus cu, corpora quaerendum te duo. Affert fastidii ad
ius, mei ancillae volutpat splendide at, etiam noluisse
adipiscing an vel. Te euismod definiebas percipitur eam,
an nam deleniti appetere voluptatibus. Affert fastidii ad
ius.An vis noster integre.
</Typography>

<div className={classes.centerFooter}>
<Typography className={classes.ipShow}>
ip: 000.000.0.00
</Typography>
<div className={classes.centerFooter}>
<Typography className={classes.ipShow}>
ip: {data && data.ip}
</Typography>

<Button
onClick={ClickLogoff}
className={classes.loggoutButton}>
LOGOUT
<Button
onClick={ClickLogoff}
className={classes.loggoutButton}>
LOGOUT
</Button>
</div>
</FormControl>
</CardContent>
</Card>
);
</div>
</FormControl>
</CardContent>
</Card>
);
}
Loading

0 comments on commit bb5187c

Please sign in to comment.