File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
web/src/app/(content)/user/[username]/edit Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { ErrorBox } from '@web/src/modules/shared/components/client/ErrorBox' ;
2
+ import { UserProfile } from '@web/src/modules/user/components/UserProfile' ;
3
+ import {
4
+ getUserProfileData ,
5
+ getUserSongs ,
6
+ } from '@web/src/modules/user/features/user.util' ;
7
+
8
+ const UserPageEdit = async ( { params } : { params : { username : string } } ) => {
9
+ const { username } = params ;
10
+
11
+ let userData = null ;
12
+ let songData = null ;
13
+
14
+ try {
15
+ userData = await getUserProfileData ( username ) ;
16
+ } catch ( e ) {
17
+ console . error ( 'Failed to get user data:' , e ) ;
18
+ }
19
+
20
+ try {
21
+ songData = await getUserSongs ( username ) ;
22
+ } catch ( e ) {
23
+ console . error ( 'Failed to get song data:' , e ) ;
24
+ }
25
+
26
+ if ( userData ) {
27
+ // set the page title to the user's name
28
+
29
+ return < UserProfile userData = { userData } songData = { songData } /> ;
30
+ } else {
31
+ return < ErrorBox message = 'Failed to get user data' /> ;
32
+ }
33
+ } ;
34
+
35
+ export default UserPageEdit ;
You can’t perform that action at this time.
0 commit comments