mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-31 17:45:22 +01:00
refs #1035 Re-fetch relationship after mute/block/follow action in sidebar
This commit is contained in:
parent
c6d244187e
commit
0579eb337e
@ -74,37 +74,42 @@ const actions: ActionTree<AccountProfileState, RootState> = {
|
||||
commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data[0])
|
||||
return res.data
|
||||
},
|
||||
follow: async ({ commit, rootState }, account: Account) => {
|
||||
follow: async ({ commit, rootState, dispatch }, account: Account) => {
|
||||
const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1')
|
||||
const res: Response<Relationship> = await client.post<Relationship>(`/accounts/${account.id}/follow`)
|
||||
commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data)
|
||||
dispatch('fetchRelationship', account)
|
||||
return res.data
|
||||
},
|
||||
unfollow: async ({ commit, rootState }, account: Account) => {
|
||||
unfollow: async ({ commit, rootState, dispatch }, account: Account) => {
|
||||
const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1')
|
||||
const res: Response<Relationship> = await client.post<Relationship>(`/accounts/${account.id}/unfollow`)
|
||||
commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data)
|
||||
dispatch('fetchRelationship', account)
|
||||
return res.data
|
||||
},
|
||||
close: ({ commit }) => {
|
||||
commit(MUTATION_TYPES.CHANGE_ACCOUNT, null)
|
||||
},
|
||||
unmute: async ({ rootState, commit }, account: Account) => {
|
||||
unmute: async ({ rootState, commit, dispatch }, account: Account) => {
|
||||
const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1')
|
||||
const res: Response<Relationship> = await client.post<Relationship>(`/accounts/${account.id}/unmute`)
|
||||
commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data)
|
||||
dispatch('fetchRelationship', account)
|
||||
return res.data
|
||||
},
|
||||
block: async ({ rootState, commit }, account: Account) => {
|
||||
block: async ({ rootState, commit, dispatch }, account: Account) => {
|
||||
const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1')
|
||||
const res: Response<Relationship> = await client.post<Relationship>(`/accounts/${account.id}/block`)
|
||||
commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data)
|
||||
dispatch('fetchRelationship', account)
|
||||
return res.data
|
||||
},
|
||||
unblock: async ({ rootState, commit }, account: Account) => {
|
||||
unblock: async ({ rootState, commit, dispatch }, account: Account) => {
|
||||
const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1')
|
||||
const res: Response<Relationship> = await client.post<Relationship>(`/accounts/${account.id}/unblock`)
|
||||
commit(MUTATION_TYPES.CHANGE_RELATIONSHIP, res.data)
|
||||
dispatch('fetchRelationship', account)
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user