From 3ebfd4b5435045a0143754fc9e3edbfbf7097e24 Mon Sep 17 00:00:00 2001 From: Andreas Kohn Date: Wed, 21 Oct 2020 22:09:49 +0200 Subject: [PATCH] fix(ui): return an empty fragment from rendering when the user/cluster isn't known (#462) * Return an empty fragment from rendering when the user/cluster isn't known * Remove the unused `callback` argument to `getCurrentUser` --- client/src/utils/Routes.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/utils/Routes.js b/client/src/utils/Routes.js index 0f96b3a86..ce3a578fb 100644 --- a/client/src/utils/Routes.js +++ b/client/src/utils/Routes.js @@ -60,7 +60,7 @@ class Routes extends Root { }); }; - getCurrentUser(callback = () => {}) { + getCurrentUser() { sessionStorage.setItem('user', ''); this.getApi(uriCurrentUser()) .then(res => { @@ -83,7 +83,6 @@ class Routes extends Root { } } this.setState({ loading: false }); - callback(); }) .catch(err => { console.error('Error:', err); @@ -111,6 +110,7 @@ class Routes extends Root { if (this.state.user.length <= 0) { this.getCurrentUser(); + return <>; } if ( @@ -118,6 +118,7 @@ class Routes extends Root { (sessionStorage.getItem('login') === 'true' || this.state.user === 'default') ) { this.getClusters(); + return <>; } if (!clusters.find(el => el.id === this.state.clusterId) && clusterId !== '401') {