0
0
Fork 0

Rewrite markers reducer in Typescript (#27644)

This commit is contained in:
Renaud Chaput 2024-03-27 13:47:09 +01:00 committed by GitHub
parent d49343ed11
commit 27d014a7fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 202 additions and 185 deletions

View file

@ -0,0 +1,18 @@
import { createReducer } from '@reduxjs/toolkit';
import { submitMarkersAction } from 'mastodon/actions/markers';
const initialState = {
home: '0',
notifications: '0',
};
export const markersReducer = createReducer(initialState, (builder) => {
builder.addCase(
submitMarkersAction.fulfilled,
(state, { payload: { home, notifications } }) => {
if (home) state.home = home;
if (notifications) state.notifications = notifications;
},
);
});