Convert notification requests actions and reducers to Typescript (#31866)
This commit is contained in:
parent
d5cf27e667
commit
c0eda832f3
12 changed files with 585 additions and 492 deletions
19
app/javascript/mastodon/models/notification_request.ts
Normal file
19
app/javascript/mastodon/models/notification_request.ts
Normal 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,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue