forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Glitch] Change
apiRequest
to accept both params
and data
Port 547e979
- Loading branch information
1 parent
6f2771c
commit 3a20290
Showing
4 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { apiRequest } from 'flavours/glitch/api'; | ||
import { apiRequestPost } from 'flavours/glitch/api'; | ||
import type { ApiRelationshipJSON } from 'flavours/glitch/api_types/relationships'; | ||
|
||
export const apiSubmitAccountNote = (id: string, value: string) => | ||
apiRequest<ApiRelationshipJSON>('post', `v1/accounts/${id}/note`, { | ||
comment: value, | ||
apiRequestPost<ApiRelationshipJSON>(`v1/accounts/${id}/note`, { | ||
data: { | ||
comment: value, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { apiRequest } from 'flavours/glitch/api'; | ||
import { apiRequestPost } from 'flavours/glitch/api'; | ||
import type { Status, StatusVisibility } from 'flavours/glitch/models/status'; | ||
|
||
export const apiReblog = (statusId: string, visibility: StatusVisibility) => | ||
apiRequest<{ reblog: Status }>('post', `v1/statuses/${statusId}/reblog`, { | ||
visibility, | ||
apiRequestPost<{ reblog: Status }>(`v1/statuses/${statusId}/reblog`, { | ||
data: { | ||
visibility, | ||
}, | ||
}); | ||
|
||
export const apiUnreblog = (statusId: string) => | ||
apiRequest<Status>('post', `v1/statuses/${statusId}/unreblog`); | ||
apiRequestPost<Status>(`v1/statuses/${statusId}/unreblog`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { apiRequest } from 'flavours/glitch/api'; | ||
import { apiRequestGet, apiRequestPut } from 'flavours/glitch/api'; | ||
import type { NotificationPolicyJSON } from 'flavours/glitch/api_types/notification_policies'; | ||
|
||
export const apiGetNotificationPolicy = () => | ||
apiRequest<NotificationPolicyJSON>('GET', '/v1/notifications/policy'); | ||
apiRequestGet<NotificationPolicyJSON>('/v1/notifications/policy'); | ||
|
||
export const apiUpdateNotificationsPolicy = ( | ||
policy: Partial<NotificationPolicyJSON>, | ||
) => | ||
apiRequest<NotificationPolicyJSON>('PUT', '/v1/notifications/policy', policy); | ||
apiRequestPut<NotificationPolicyJSON>('/v1/notifications/policy', { | ||
data: policy, | ||
}); |