0
0
Fork 0

Convert notification requests actions and reducers to Typescript (#31866)

This commit is contained in:
Claire 2024-09-16 11:54:03 +02:00 committed by GitHub
parent d5cf27e667
commit c0eda832f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 585 additions and 492 deletions

View file

@ -0,0 +1,19 @@
import type { ApiNotificationRequestJSON } from 'mastodon/api_types/notifications';
export interface NotificationRequest
extends Omit<ApiNotificationRequestJSON, 'account' | 'notifications_count'> {
account_id: string;
notifications_count: number;
}
export function createNotificationRequestFromJSON(
requestJSON: ApiNotificationRequestJSON,
): NotificationRequest {
const { account, notifications_count, ...request } = requestJSON;
return {
account_id: account.id,
notifications_count: +notifications_count,
...request,
};
}