Skip to content

Commit 109719f

Browse files
author
Hina Shah
committed
BUG: gpt form authorization is pointing at wrong path
1 parent 7a4e168 commit 109719f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/pages/answer/GPTForm.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@material-ui/core';
88
import { Alert } from '@material-ui/lab';
99
import GPTContext from '../../context/gpt';
10+
import { api } from '../../API/baseUrlProxy';
1011

1112
const 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);

0 commit comments

Comments
 (0)