From defe49d0f9143a1bb024f42930b08330f883cf79 Mon Sep 17 00:00:00 2001 From: Alan Greene Date: Fri, 2 Jul 2021 19:54:15 +0100 Subject: [PATCH] Fix client mode Fix the error handling code used to detect when the Dashboard is running in client mode (via `kubectl proxy`). Remove the unwanted `data` field so we can correctly process the response and provide the expected default install properties. --- src/api/index.js | 2 +- src/api/index.test.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index c7b1856db..cfa552b98 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -57,7 +57,7 @@ export async function getInstallProperties() { try { data = await get(uri); } catch (error) { - if (error?.response?.data?.status === 404) { + if (error?.response?.status === 404) { data = { dashboardNamespace: 'N/A', dashboardVersion: 'kubectl-proxy-client', diff --git a/src/api/index.test.js b/src/api/index.test.js index 999fcb7e4..11b1994aa 100644 --- a/src/api/index.test.js +++ b/src/api/index.test.js @@ -447,9 +447,7 @@ describe('getInstallProperties', () => { it('handles error in case of Dashboard client mode', async () => { const error = new Error(); error.response = { - data: { - status: 404 - } + status: 404 }; fetchMock.get(/properties/, { throws: error }); const properties = await API.getInstallProperties();