Skip to content

Commit

Permalink
BUG: gpt form authorization is pointing at wrong path
Browse files Browse the repository at this point in the history
  • Loading branch information
Hina Shah committed Feb 5, 2024
1 parent 7a4e168 commit 109719f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pages/answer/GPTForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@material-ui/core';
import { Alert } from '@material-ui/lab';
import GPTContext from '../../context/gpt';
import { api } from '../../API/baseUrlProxy';

const EnableForm = ({ open, handleClose }) => {
const { setToken } = useContext(GPTContext);
Expand Down Expand Up @@ -34,12 +35,12 @@ const EnableForm = ({ open, handleClose }) => {

let res;
try {
res = await fetch('/api/gpt/auth', {
method: 'POST',
res = await api.post('/api/gpt/auth', {
pw: password,
}, {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ pw: password }),
signal: controllerRef.current ? controllerRef.current.signal : undefined,
});
} catch (err) {
Expand All @@ -53,7 +54,7 @@ const EnableForm = ({ open, handleClose }) => {
return;
}

const apiResponse = await res.json();
const apiResponse = await res.data;

if (apiResponse.status === 'error') {
setError(apiResponse.message);
Expand Down

0 comments on commit 109719f

Please sign in to comment.