From 61a58df7062ffc0e3abfd85d37e840e0c3ec3885 Mon Sep 17 00:00:00 2001 From: Kayvon-Martinez <142514475+Kayvon-Martinez@users.noreply.github.com> Date: Thu, 26 Oct 2023 22:32:17 -0500 Subject: [PATCH] Auth header and state changes Changed conditional for auth header and when the new connection settings are saved. --- .../pages/data/tabs/download/DownloadTab.tsx | 2 +- .../src/pages/data/tabs/upload/UploadTab.tsx | 2 +- frontend/src/pages/debug/DebugPage.tsx | 2 +- frontend/src/pages/settings/SettingsPage.tsx | 17 +++++++++-------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/frontend/src/pages/data/tabs/download/DownloadTab.tsx b/frontend/src/pages/data/tabs/download/DownloadTab.tsx index b4024cd..73c9df5 100644 --- a/frontend/src/pages/data/tabs/download/DownloadTab.tsx +++ b/frontend/src/pages/data/tabs/download/DownloadTab.tsx @@ -17,7 +17,7 @@ function DownloadTab() { }/api/codex/v1/download/${cid}`, { headers: - (nodeInfo.auth && { + (nodeInfo.auth !== null && { Authorization: (nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "", }) || diff --git a/frontend/src/pages/data/tabs/upload/UploadTab.tsx b/frontend/src/pages/data/tabs/upload/UploadTab.tsx index 3d0b30a..8a9c5c9 100644 --- a/frontend/src/pages/data/tabs/upload/UploadTab.tsx +++ b/frontend/src/pages/data/tabs/upload/UploadTab.tsx @@ -45,7 +45,7 @@ function UploadTab() { try { await axios .post(`${constants.testApiBaseUrl}/upload`, bytes, { - headers: (nodeInfo.auth && { + headers: (nodeInfo.auth !== null && { "Base-Url": nodeInfo.nodeToConnectTo || nodeInfo.baseUrl, "Content-Type": "application/octet-stream", "Auth-String": nodeInfo.auth, diff --git a/frontend/src/pages/debug/DebugPage.tsx b/frontend/src/pages/debug/DebugPage.tsx index a2f8eaf..0863b8a 100644 --- a/frontend/src/pages/debug/DebugPage.tsx +++ b/frontend/src/pages/debug/DebugPage.tsx @@ -24,7 +24,7 @@ function DebugPage() { }/api/codex/v1/debug/info`, { headers: - (nodeInfo.auth && { + (nodeInfo.auth !== null && { Authorization: (nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "", }) || diff --git a/frontend/src/pages/settings/SettingsPage.tsx b/frontend/src/pages/settings/SettingsPage.tsx index 328f091..0ea6ad9 100644 --- a/frontend/src/pages/settings/SettingsPage.tsx +++ b/frontend/src/pages/settings/SettingsPage.tsx @@ -117,14 +117,6 @@ function SettingsPage() { />