mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-12-09 05:59:03 +01:00
131696277c
Port 0a6b75b71e
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
25 lines
787 B
TypeScript
25 lines
787 B
TypeScript
import { createReducer, isAnyOf } from '@reduxjs/toolkit';
|
|
|
|
import {
|
|
fetchNotificationPolicy,
|
|
decreasePendingRequestsCount,
|
|
updateNotificationsPolicy,
|
|
} from 'flavours/glitch/actions/notification_policies';
|
|
import type { NotificationPolicy } from 'flavours/glitch/models/notification_policy';
|
|
|
|
export const notificationPolicyReducer =
|
|
createReducer<NotificationPolicy | null>(null, (builder) => {
|
|
builder
|
|
.addCase(decreasePendingRequestsCount, (state, action) => {
|
|
if (state) {
|
|
state.summary.pending_requests_count -= action.payload;
|
|
}
|
|
})
|
|
.addMatcher(
|
|
isAnyOf(
|
|
fetchNotificationPolicy.fulfilled,
|
|
updateNotificationsPolicy.fulfilled,
|
|
),
|
|
(_state, action) => action.payload,
|
|
);
|
|
});
|