Prevent multiple toot submissions
This commit is contained in:
parent
97050fdbe1
commit
66c5c3df35
|
@ -95,6 +95,10 @@ const NewToot = {
|
||||||
if (rootState.TimelineSpace.account.accessToken === undefined || rootState.TimelineSpace.account.accessToken === null) {
|
if (rootState.TimelineSpace.account.accessToken === undefined || rootState.TimelineSpace.account.accessToken === null) {
|
||||||
throw new AuthenticationError()
|
throw new AuthenticationError()
|
||||||
}
|
}
|
||||||
|
if (state.blockSubmit) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
commit('changeBlockSubmit', true)
|
||||||
const client = new Mastodon(
|
const client = new Mastodon(
|
||||||
rootState.TimelineSpace.account.accessToken,
|
rootState.TimelineSpace.account.accessToken,
|
||||||
rootState.TimelineSpace.account.baseURL + '/api/v1'
|
rootState.TimelineSpace.account.baseURL + '/api/v1'
|
||||||
|
@ -102,8 +106,13 @@ const NewToot = {
|
||||||
return client.post('/statuses', form)
|
return client.post('/statuses', form)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
ipcRenderer.send('toot-action-sound')
|
ipcRenderer.send('toot-action-sound')
|
||||||
|
commit('changeBlockSubmit', false)
|
||||||
return res.data
|
return res.data
|
||||||
})
|
})
|
||||||
|
.catch(e => {
|
||||||
|
commit('changeBlockSubmit', false)
|
||||||
|
throw e
|
||||||
|
})
|
||||||
},
|
},
|
||||||
openReply ({ dispatch, commit, rootState }, message) {
|
openReply ({ dispatch, commit, rootState }, message) {
|
||||||
commit('setReplyTo', message)
|
commit('setReplyTo', message)
|
||||||
|
|
Loading…
Reference in New Issue