0
0
Fork 0

Change grouped notifications API shape (take 2) (#31214)

This commit is contained in:
Claire 2024-07-31 12:50:13 +02:00 committed by GitHub
parent 288961bbb9
commit 549ab089ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 70 additions and 20 deletions

View file

@ -1,17 +1,24 @@
import api, { apiRequest, getLinks } from 'mastodon/api';
import type { ApiNotificationGroupJSON } from 'mastodon/api_types/notifications';
import type { ApiNotificationGroupsResultJSON } from 'mastodon/api_types/notifications';
export const apiFetchNotifications = async (params?: {
exclude_types?: string[];
max_id?: string;
}) => {
const response = await api().request<ApiNotificationGroupJSON[]>({
const response = await api().request<ApiNotificationGroupsResultJSON>({
method: 'GET',
url: '/api/v2_alpha/notifications',
params,
});
return { notifications: response.data, links: getLinks(response) };
const { statuses, accounts, notification_groups } = response.data;
return {
statuses,
accounts,
notifications: notification_groups,
links: getLinks(response),
};
};
export const apiClearNotifications = () =>