From 5161621733a61de84ff0128e6a5a0b5a1ca9a02b Mon Sep 17 00:00:00 2001
From: Marc Nuri <marc@marcnuri.com>
Date: Mon, 6 May 2024 16:19:21 +0200
Subject: [PATCH] refactor: watch uses named exports

---
 src/main/frontend/src/App.js         | 6 +++---
 src/main/frontend/src/watch/api.js   | 6 +-----
 src/main/frontend/src/watch/index.js | 8 +-------
 3 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/main/frontend/src/App.js b/src/main/frontend/src/App.js
index bcc995e..6450c14 100644
--- a/src/main/frontend/src/App.js
+++ b/src/main/frontend/src/App.js
@@ -96,7 +96,7 @@ import {
   StatefulSetsDetailPage,
   StatefulSetsEditPage
 } from './statefulsets';
-import watch from './watch';
+import {startEventSource} from './watch';
 import {Home} from './Home';
 
 let eventSource;
@@ -117,7 +117,7 @@ const pollResources = dispatch => {
       console.error('EventSource connection was lost, reconnecting');
       dispatch(setOffline(true));
       eventSource.close();
-      eventSource = watch.api.startEventSource({dispatch});
+      eventSource = startEventSource({dispatch});
     }
     pollResourcesTimeout = setTimeout(dispatchedPoll, 3000);
   };
@@ -125,7 +125,7 @@ const pollResources = dispatch => {
 };
 
 const onMount = ({dispatch}) => {
-  eventSource = watch.api.startEventSource({dispatch});
+  eventSource = startEventSource({dispatch});
   pollResources(dispatch)();
 };
 
diff --git a/src/main/frontend/src/watch/api.js b/src/main/frontend/src/watch/api.js
index a8a0ddb..915bcc5 100644
--- a/src/main/frontend/src/watch/api.js
+++ b/src/main/frontend/src/watch/api.js
@@ -25,9 +25,7 @@ import {
   setOffline
 } from '../redux';
 
-const api = {};
-
-api.startEventSource = ({dispatch}) => {
+export const startEventSource = ({dispatch}) => {
   const actions = bindActionCreators(
     {
       clear,
@@ -76,5 +74,3 @@ api.startEventSource = ({dispatch}) => {
   };
   return eventSource;
 };
-
-export default api;
diff --git a/src/main/frontend/src/watch/index.js b/src/main/frontend/src/watch/index.js
index e80354f..b3b5413 100644
--- a/src/main/frontend/src/watch/index.js
+++ b/src/main/frontend/src/watch/index.js
@@ -14,10 +14,4 @@
  * limitations under the License.
  *
  */
-import api from './api';
-
-const watch = {};
-
-watch.api = api;
-
-export default watch;
+export {startEventSource} from './api';