1
1
import { forwardRef , useState } from 'react' ;
2
2
import { Box , Button , FormControl , FormHelperText , Stack , TextField , Typography } from '@mui/material' ;
3
- // import { userClient } from '../../utils/api';
4
- // import axios from 'axios';
5
- // import { FAILED_PROFILE_UPDATE_MESSAGE, SUCCESS_PROFILE_UPDATE_MESSAGE } from '../../utils/constants';
3
+ import { userClient } from '../../utils/api' ;
4
+ import axios from 'axios' ;
5
+ import { FAILED_PROFILE_UPDATE_MESSAGE , SUCCESS_PROFILE_UPDATE_MESSAGE } from '../../utils/constants' ;
6
6
7
7
interface EditProfileModalProps {
8
8
handleClose : ( ) => void ;
@@ -14,8 +14,7 @@ interface EditProfileModalProps {
14
14
}
15
15
16
16
const EditProfileModal = forwardRef < HTMLDivElement , EditProfileModalProps > ( ( props , ref ) => {
17
- const { handleClose, currFirstName, currLastName, currBiography } = props ;
18
- //const { handleClose, currFirstName, currLastName, currBiography, userId, onUpdate } = props;
17
+ const { handleClose, currFirstName, currLastName, currBiography, userId, onUpdate } = props ;
19
18
const nameCharLimit = 50 ;
20
19
const bioCharLimit = 255 ;
21
20
const [ newFirstName , setNewFirstName ] = useState < string > ( currFirstName ) ;
@@ -39,7 +38,7 @@ const EditProfileModal = forwardRef<HTMLDivElement, EditProfileModalProps>((prop
39
38
40
39
const handleSubmit = async ( ) => {
41
40
// TODO: test with token (only tested without)
42
- /* const accessToken = localStorage.getItem("token");
41
+ const accessToken = localStorage . getItem ( "token" ) ;
43
42
44
43
try {
45
44
await userClient . patch (
@@ -66,7 +65,7 @@ const EditProfileModal = forwardRef<HTMLDivElement, EditProfileModalProps>((prop
66
65
} else {
67
66
onUpdate ( FAILED_PROFILE_UPDATE_MESSAGE , false ) ;
68
67
}
69
- }*/
68
+ }
70
69
} ;
71
70
72
71
return (
0 commit comments