catstodon/app/javascript/flavours/glitch/reducers/notification_policy.ts
Renaud Chaput af0a1a8774 [Glitch] Convert notifications policies frontend code to Typescript
Port d558dfd77d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-06-18 18:22:40 +02:00

18 lines
564 B
TypeScript

import { createReducer, isAnyOf } from '@reduxjs/toolkit';
import {
fetchNotificationPolicy,
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.addMatcher(
isAnyOf(
fetchNotificationPolicy.fulfilled,
updateNotificationsPolicy.fulfilled,
),
(_state, action) => action.payload,
);
});