Skip to content

Commit

Permalink
Merge pull request #2 from PedroGuilhermeFariaDuarte/FixBugProfile
Browse files Browse the repository at this point in the history
Corrigido o bug que não permitia a exibição do email
  • Loading branch information
PedroGuilhermeFariaDuarte authored Feb 3, 2020
2 parents c7acdf6 + e58fc5d commit 2ecead8
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions browser/src/pages/Profile/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import React, { useState, useEffect } from "react";
import { toast } from "react-toastify";
import React, { useState, useEffect } from 'react';
import { toast } from 'react-toastify';

// Icon
import { MdKeyboardBackspace } from "react-icons/md";
import { MdKeyboardBackspace } from 'react-icons/md';

// Global styles
import { Container } from "../../components/Container";
import { ArrorBack } from "../../components/ArrorBack";
import { Container } from '../../components/Container';
import { ArrorBack } from '../../components/ArrorBack';

// Style
import {
ProfileContainer,
UserInfo,
Info,
TagsContainer,
StatesContainer
} from "./styles";
StatesContainer,
} from './styles';

// Services
import api from "../../services/Api";
import api from '../../services/Api';

function Profile({ history }) {
const [profile, setProfile] = useState({
Expand All @@ -29,16 +29,16 @@ function Profile({ history }) {
following: [],
idusuario: null,
name: null,
email: null
email: null,
});

const meuID = sessionStorage.getItem("@findev/session");
const meuID = sessionStorage.getItem('@findev/session');

async function handlerFollower() {
try {
const { data: followingResponse } = await api.post("follower", {
const { data: followingResponse } = await api.post('follower', {
seguidorID: meuID,
idusuario: profile.idusuario
idusuario: profile.idusuario,
});

if (followingResponse.code === 6) {
Expand All @@ -56,9 +56,9 @@ function Profile({ history }) {
async function handlerUnFollower() {
try {
const { data: seguindoResponse } = await api.delete(
"follower/unfollowing",
'follower/unfollowing',
{
params: { seguidorID: meuID, idusuario: profile.idusuario }
params: { seguidorID: meuID, idusuario: profile.idusuario },
}
);

Expand All @@ -74,14 +74,14 @@ function Profile({ history }) {
}

function handlerBackPage() {
history.push("/devs");
history.push('/devs');
}

useEffect(() => {
async function loadDev() {
try {
const response = await api.get("user", {
params: { id: history.location.state.id }
const response = await api.get('user', {
params: { id: history.location.state.id },
});

if (response.data.code === 6) {
Expand All @@ -90,7 +90,7 @@ function Profile({ history }) {
}

if (response.data.length === 0) {
history.push("/login");
history.push('/login');
return;
}

Expand All @@ -100,10 +100,10 @@ function Profile({ history }) {
avatar_url,
followers,
following,
_id: idusuario
_id: idusuario,
} = response.data;

const { name, email } = response.data;
const { name, email } = response.data.user;

setProfile({
techs,
Expand All @@ -113,17 +113,17 @@ function Profile({ history }) {
following,
idusuario,
name,
email
email,
});
} catch (error) {
toast.error("TESTE" + error.message);
toast.error('TESTE' + error.message);
}
}

function handlerVerifySession() {
const sessionID = sessionStorage.getItem("@findev/session");
const sessionID = sessionStorage.getItem('@findev/session');
if (!sessionID) {
history.push("/");
history.push('/');
} else {
loadDev();
}
Expand Down Expand Up @@ -164,7 +164,7 @@ function Profile({ history }) {
</button>
)
) : (
""
''
)}
<TagsContainer>
<ul>
Expand Down

0 comments on commit 2ecead8

Please sign in to comment.