Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: watch uses named exports #91

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ import {
StatefulSetsDetailPage,
StatefulSetsEditPage
} from './statefulsets';
import watch from './watch';
import {startEventSource} from './watch';
import {Home} from './Home';

let eventSource;
@@ -117,15 +117,15 @@ 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);
};
return dispatchedPoll;
};

const onMount = ({dispatch}) => {
eventSource = watch.api.startEventSource({dispatch});
eventSource = startEventSource({dispatch});
pollResources(dispatch)();
};

6 changes: 1 addition & 5 deletions src/main/frontend/src/watch/api.js
Original file line number Diff line number Diff line change
@@ -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;
8 changes: 1 addition & 7 deletions src/main/frontend/src/watch/index.js
Original file line number Diff line number Diff line change
@@ -14,10 +14,4 @@
* limitations under the License.
*
*/
import api from './api';

const watch = {};

watch.api = api;

export default watch;
export {startEventSource} from './api';