Skip to content

Commit

Permalink
Perfil desparametrizado, ya funcionan los perfiles de amigos
Browse files Browse the repository at this point in the history
  • Loading branch information
CANCI0 committed Apr 26, 2024
1 parent f18938b commit dfd2533
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion webapp/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function App() {
<Route path="/social/misgrupos" element={<UserGroups />} />
<Route path="/social/grupo/:groupName" element={<GroupDetails />} />

<Route path="/perfil/:user" element={<Perfil />} />
<Route path="/perfil" element={<Perfil />} />
<Route path="/history" element={<History />} />
<Route path="/config" element={<Config />} />
</Route>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe("Nav Component", () => {
const perfilButton = screen.getByText("Mi perfil");
fireEvent.click(perfilButton);

expect(window.location.pathname).toBe("/perfil/testuser");
expect(window.location.pathname).toBe("/perfil");
});

test("navigates to /sobre when Sobre nosotros button is clicked", () => {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/Nav/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const Nav = () => {
</MenuButton>
<MenuList>
<MenuGroup title={t("components.nav.profile")}>
<MenuItem onClick={() => handleNavigate(`/perfil/${username}`)}>
<MenuItem onClick={() => handleNavigate("/perfil")}>
{t("components.nav.myprofile")}
</MenuItem>
<MenuItem onClick={() => handleNavigate("/history")}>
Expand Down
6 changes: 4 additions & 2 deletions webapp/src/components/Profile/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const Profile = (user) => {

const { t } = useTranslation();

const username = (user && user.username) || localStorage.getItem("username");

useEffect(() => {
fetch(gatewayUrl + `/userInfo/${user.username}`)
fetch(gatewayUrl + `/userInfo/${username}`)
.then((response) => response.json())
.then((data) => {
setUserData(data);
Expand Down Expand Up @@ -42,7 +44,7 @@ const Profile = (user) => {
<>
{userData && (
<>
<Avatar name={user.username} />
<Avatar name={username} />
<Text justifyContent={"center"}>
<strong>{t('components.profile.name')}</strong> {userData.username}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/pages/Perfil/Perfil.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Perfil = () => {
return (
<>
<Nav />
<Profile username={username.username}/>
<Profile username={username}/>
<Footer />
</>
);
Expand Down

0 comments on commit dfd2533

Please sign in to comment.