diff --git a/src/actions/service-worker.ts b/src/actions/service-worker.ts index 6f97475d..25386eb5 100644 --- a/src/actions/service-worker.ts +++ b/src/actions/service-worker.ts @@ -4,8 +4,8 @@ import { Action } from 'redux'; export enum ServiceWorkerActionType { - Update = 'serviceWorker.update', - Success = 'serviceWorker.success', + DidUpdate = 'serviceWorker.didUpdate', + DidSucceed = 'serviceWorker.didSucceed', } export type ServiceWorkerAction< @@ -14,14 +14,14 @@ export type ServiceWorkerAction< registration: ServiceWorkerRegistration; }; -export function update( +export function didUpdate( registration: ServiceWorkerRegistration, -): ServiceWorkerAction { - return { type: ServiceWorkerActionType.Update, registration }; +): ServiceWorkerAction { + return { type: ServiceWorkerActionType.DidUpdate, registration }; } -export function success( +export function didSucceed( registration: ServiceWorkerRegistration, -): ServiceWorkerAction { - return { type: ServiceWorkerActionType.Success, registration }; +): ServiceWorkerAction { + return { type: ServiceWorkerActionType.DidSucceed, registration }; } diff --git a/src/index.tsx b/src/index.tsx index 28a05b9a..dd2a51cd 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,7 +10,7 @@ import { applyMiddleware, createStore } from 'redux'; import { createLogger } from 'redux-logger'; import createSagaMiddleware from 'redux-saga'; import './index.scss'; -import { success, update } from './actions/service-worker'; +import { didSucceed, didUpdate } from './actions/service-worker'; import App from './components/App'; import NotificationStack from './components/NotificationStack'; import rootReducer from './reducers'; @@ -76,8 +76,8 @@ ReactDOM.render( // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://cra.link/PWA serviceWorkerRegistration.register({ - onUpdate: (r) => store.dispatch(update(r)), - onSuccess: (r) => store.dispatch(success(r)), + onUpdate: (r) => store.dispatch(didUpdate(r)), + onSuccess: (r) => store.dispatch(didSucceed(r)), }); // If you want to start measuring performance in your app, pass a function diff --git a/src/reducers/notification.ts b/src/reducers/notification.ts index a2cd255e..690fa1ab 100644 --- a/src/reducers/notification.ts +++ b/src/reducers/notification.ts @@ -147,7 +147,7 @@ const list: Reducer = (state = [], action) => { ]; case NotificationActionType.Remove: return state.filter((e) => e.id !== action.id); - case ServiceWorkerActionType.Update: + case ServiceWorkerActionType.DidUpdate: return append( state, Level.Info, @@ -155,7 +155,7 @@ const list: Reducer = (state = [], action) => { undefined, 'https://github.com/pybricks/pybricks-code/issues/102', ); - case ServiceWorkerActionType.Success: + case ServiceWorkerActionType.DidSucceed: return append(state, Level.Info, MessageId.ServiceWorkerSuccess); default: return state;