mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Basic editing works
This commit is contained in:
@ -13,6 +13,7 @@ import {
|
||||
useMutation
|
||||
} from 'react-query'
|
||||
import deleteItem from './timeline/deleteItem'
|
||||
import editItem from './timeline/editItem'
|
||||
import updateStatusProperty from './timeline/updateStatusProperty'
|
||||
|
||||
export type QueryKeyTimeline = [
|
||||
@ -303,13 +304,21 @@ export type MutationVarsTimelineUpdateAccountProperty = {
|
||||
}
|
||||
}
|
||||
|
||||
export type MutationVarsTimelineEditItem = {
|
||||
// This is for editing status
|
||||
type: 'editItem'
|
||||
queryKey?: QueryKeyTimeline
|
||||
rootQueryKey?: QueryKeyTimeline
|
||||
status: Mastodon.Status
|
||||
}
|
||||
|
||||
export type MutationVarsTimelineDeleteItem = {
|
||||
// This is for deleting status and conversation
|
||||
type: 'deleteItem'
|
||||
source: 'statuses' | 'conversations'
|
||||
queryKey?: QueryKeyTimeline
|
||||
rootQueryKey?: QueryKeyTimeline
|
||||
id: Mastodon.Conversation['id']
|
||||
id: Mastodon.Status['id']
|
||||
}
|
||||
|
||||
export type MutationVarsTimelineDomainBlock = {
|
||||
@ -322,6 +331,7 @@ export type MutationVarsTimelineDomainBlock = {
|
||||
export type MutationVarsTimeline =
|
||||
| MutationVarsTimelineUpdateStatusProperty
|
||||
| MutationVarsTimelineUpdateAccountProperty
|
||||
| MutationVarsTimelineEditItem
|
||||
| MutationVarsTimelineDeleteItem
|
||||
| MutationVarsTimelineDomainBlock
|
||||
|
||||
@ -371,6 +381,8 @@ const mutationFunction = async (params: MutationVarsTimeline) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
case 'editItem':
|
||||
return { body: params.status }
|
||||
case 'deleteItem':
|
||||
return apiInstance<Mastodon.Conversation>({
|
||||
method: 'delete',
|
||||
@ -423,6 +435,9 @@ const useTimelineMutation = ({
|
||||
case 'updateStatusProperty':
|
||||
updateStatusProperty(params)
|
||||
break
|
||||
case 'editItem':
|
||||
editItem(params)
|
||||
break
|
||||
case 'deleteItem':
|
||||
deleteItem(params)
|
||||
break
|
||||
|
Reference in New Issue
Block a user