From a0b6d4caba55d5139e303fbac0fafa8417069b7d Mon Sep 17 00:00:00 2001 From: "Tran, Alex" Date: Thu, 29 Aug 2024 09:41:51 -0400 Subject: [PATCH] reconfigure fetching systems to look for a status instead of ok. --- src/axiosConfig.ts | 5 ++++- src/views/FismaTable/FismaTable.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/axiosConfig.ts b/src/axiosConfig.ts index f8a4fce..e121375 100644 --- a/src/axiosConfig.ts +++ b/src/axiosConfig.ts @@ -7,5 +7,8 @@ const axiosInstance: AxiosInstance = axios.create({ }, // withCredentials: true, }) - +if (process.env.NODE_ENV === 'development') { + axiosInstance.defaults.headers.common['Authorization'] = + `Bearer ${import.meta.env.VITE_AUTH_TOKEN3 || ''}` +} export default axiosInstance diff --git a/src/views/FismaTable/FismaTable.tsx b/src/views/FismaTable/FismaTable.tsx index 124604b..aa84589 100644 --- a/src/views/FismaTable/FismaTable.tsx +++ b/src/views/FismaTable/FismaTable.tsx @@ -190,7 +190,7 @@ export default function FismaTable() { const fetchFismaSystems = async () => { try { const fismaSystems = await axiosInstance.get('/fismasystems') - if (!fismaSystems.statusText) { + if (fismaSystems.status !== 200) { throw new Error('Failed to fetch data') } setFismaSystems(fismaSystems.data)