1
1
import React , { useEffect , useState } from 'react' ;
2
2
import { TextInput , Button , Group , Box , LoadingOverlay , Alert } from '@mantine/core' ;
3
3
import { UserProfileData } from '@common/types/msGraphApi' ;
4
- import { useAuth } from '@ui/components/AuthContext' ;
5
4
import { notifications } from '@mantine/notifications' ;
6
5
import { useNavigate } from 'react-router-dom' ;
7
- import { IconMoodSmileBeam , IconQuestionMark } from '@tabler/icons-react' ;
6
+ import { IconMoodSmileBeam } from '@tabler/icons-react' ;
8
7
9
8
interface ManageProfileComponentProps {
10
9
getProfile : ( ) => Promise < UserProfileData > ;
11
10
setProfile : ( data : UserProfileData ) => Promise < any > ;
12
11
firstTime : boolean ;
13
- returnTo ?: string ;
14
12
}
15
13
16
14
export const ManageProfileComponent : React . FC < ManageProfileComponentProps > = ( {
17
15
getProfile,
18
16
setProfile,
19
17
firstTime,
20
- returnTo,
21
18
} ) => {
22
- const { userData, setLoginStatus } = useAuth ( ) ;
23
19
const navigate = useNavigate ( ) ;
24
20
const [ userProfile , setUserProfile ] = useState < undefined | null | UserProfileData > ( undefined ) ;
25
21
const [ loading , setLoading ] = useState ( false ) ;
@@ -53,10 +49,6 @@ export const ManageProfileComponent: React.FC<ManageProfileComponentProps> = ({
53
49
title : 'Profile updated successfully' ,
54
50
message : 'Changes may take some time to reflect.' ,
55
51
} ) ;
56
- setLoginStatus ( true ) ;
57
- if ( returnTo ) {
58
- return navigate ( returnTo ) ;
59
- }
60
52
await fetchProfile ( ) ;
61
53
} catch ( e ) {
62
54
console . error ( e ) ;
@@ -97,7 +89,7 @@ export const ManageProfileComponent: React.FC<ManageProfileComponentProps> = ({
97
89
onChange = { ( e ) =>
98
90
setUserProfile ( ( prev ) => prev && { ...prev , displayName : e . target . value } )
99
91
}
100
- placeholder = { userData ?. name }
92
+ placeholder = { userProfile ?. displayName }
101
93
required
102
94
/>
103
95
< TextInput
@@ -120,8 +112,9 @@ export const ManageProfileComponent: React.FC<ManageProfileComponentProps> = ({
120
112
label = "Email"
121
113
value = { userProfile ?. mail || '' }
122
114
onChange = { ( e ) => setUserProfile ( ( prev ) => prev && { ...prev , mail : e . target . value } ) }
123
- placeholder = { userData ?. email }
115
+ placeholder = { userProfile ?. mail }
124
116
required
117
+ disabled
125
118
/>
126
119
127
120
< TextInput
0 commit comments