File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 77} from '@material-ui/core' ;
88import { Alert } from '@material-ui/lab' ;
99import GPTContext from '../../context/gpt' ;
10+ import { api } from '../../API/baseUrlProxy' ;
1011
1112const EnableForm = ( { open, handleClose } ) => {
1213 const { setToken } = useContext ( GPTContext ) ;
@@ -34,12 +35,12 @@ const EnableForm = ({ open, handleClose }) => {
3435
3536 let res ;
3637 try {
37- res = await fetch ( '/api/gpt/auth' , {
38- method : 'POST' ,
38+ res = await api . post ( '/api/gpt/auth' , {
39+ pw : password ,
40+ } , {
3941 headers : {
4042 'Content-Type' : 'application/json' ,
4143 } ,
42- body : JSON . stringify ( { pw : password } ) ,
4344 signal : controllerRef . current ? controllerRef . current . signal : undefined ,
4445 } ) ;
4546 } catch ( err ) {
@@ -53,7 +54,7 @@ const EnableForm = ({ open, handleClose }) => {
5354 return ;
5455 }
5556
56- const apiResponse = await res . json ( ) ;
57+ const apiResponse = await res . data ;
5758
5859 if ( apiResponse . status === 'error' ) {
5960 setError ( apiResponse . message ) ;
You can’t perform that action at this time.
0 commit comments