Convert notifications policies frontend code to Typescript (#29868)
This commit is contained in:
parent
50db95b9a1
commit
d558dfd77d
12 changed files with 140 additions and 106 deletions
18
app/javascript/mastodon/reducers/notification_policy.ts
Normal file
18
app/javascript/mastodon/reducers/notification_policy.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { createReducer, isAnyOf } from '@reduxjs/toolkit';
|
||||
|
||||
import {
|
||||
fetchNotificationPolicy,
|
||||
updateNotificationsPolicy,
|
||||
} from 'mastodon/actions/notification_policies';
|
||||
import type { NotificationPolicy } from 'mastodon/models/notification_policy';
|
||||
|
||||
export const notificationPolicyReducer =
|
||||
createReducer<NotificationPolicy | null>(null, (builder) => {
|
||||
builder.addMatcher(
|
||||
isAnyOf(
|
||||
fetchNotificationPolicy.fulfilled,
|
||||
updateNotificationsPolicy.fulfilled,
|
||||
),
|
||||
(_state, action) => action.payload,
|
||||
);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue