1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Lots of updates

This commit is contained in:
Zhiyuan Zheng
2021-01-07 19:13:09 +01:00
parent dcb36a682d
commit 4b99813bb7
104 changed files with 2463 additions and 1619 deletions

View File

@ -15,12 +15,12 @@ export interface Props {
const RelationshipIncoming: React.FC<Props> = ({ id }) => {
const { t } = useTranslation()
const relationshipQueryKey: QueryKey.Relationship = ['Relationship', { id }]
const relationshipQueryKey = ['Relationship', { id }]
const queryClient = useQueryClient()
const fireMutation = useCallback(
({ type }: { type: 'authorize' | 'reject' }) => {
return client({
return client<Mastodon.Relationship>({
method: 'post',
instance: 'local',
url: `follow_requests/${id}/${type}`
@ -29,9 +29,9 @@ const RelationshipIncoming: React.FC<Props> = ({ id }) => {
[]
)
const mutation = useMutation(fireMutation, {
onSuccess: ({ body }) => {
onSuccess: res => {
haptics('Success')
queryClient.setQueryData(relationshipQueryKey, body)
queryClient.setQueryData(relationshipQueryKey, res)
queryClient.refetchQueries(['Notifications'])
},
onError: (err: any, { type }) => {