From 109719f483828cd397f6b10f50b7ce6360e16609 Mon Sep 17 00:00:00 2001 From: Hina Shah Date: Mon, 5 Feb 2024 14:15:46 -0500 Subject: [PATCH] BUG: gpt form authorization is pointing at wrong path --- src/pages/answer/GPTForm.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/answer/GPTForm.jsx b/src/pages/answer/GPTForm.jsx index a0d8f186..44fb2a5d 100644 --- a/src/pages/answer/GPTForm.jsx +++ b/src/pages/answer/GPTForm.jsx @@ -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); @@ -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) { @@ -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);