From 78ca3ef054de46da5a53a93a3551f065390d4a6a Mon Sep 17 00:00:00 2001 From: Kentai Radiquum Date: Sat, 27 Apr 2024 10:39:57 +0500 Subject: [PATCH] frontend: add route to view other user profiles by id --- TODO.md | 4 --- .../components/UserProfile/UserProfile.jsx | 2 +- frontend/app/profile/[id]/page.js | 34 +++++++++++++++++++ frontend/next.config.mjs | 4 +++ 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 frontend/app/profile/[id]/page.js diff --git a/TODO.md b/TODO.md index 3f4b426..71361fc 100644 --- a/TODO.md +++ b/TODO.md @@ -20,7 +20,3 @@ - [ ] Избранное - [ ] История - [ ] ... - -## интерфейс - -- [X] Динамический цвет от аватарки diff --git a/frontend/app/components/UserProfile/UserProfile.jsx b/frontend/app/components/UserProfile/UserProfile.jsx index dbdb1af..b51f928 100644 --- a/frontend/app/components/UserProfile/UserProfile.jsx +++ b/frontend/app/components/UserProfile/UserProfile.jsx @@ -97,7 +97,7 @@ export const UserProfile = (props) => { Ваш профиль { + async function _getProfile() { + const _profile = await getData( + `${endpoints.user.profile}/${props.params.id}`, + ); + setProfile(_profile); + } + _getProfile(); + }, [props.params.id]); + + return ( + <> + {profile ? ( + profile.profile ? ( + + ) : ( + notFound() + ) + ) : ( + + )} + + ); +} diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index d37672a..e7af06f 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -7,6 +7,10 @@ const nextConfig = { protocol: "https", hostname: "anixstatic.com", }, + { + protocol: "https", + hostname: "i.imgur.com", + }, ], }, };