refs #921 Change loading only modal is opened in new toot
This commit is contained in:
parent
c4055095c7
commit
c602bd87a4
|
@ -141,15 +141,25 @@ const mutations: MutationTree<NewTootState> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const actions: ActionTree<NewTootState, RootState> = {
|
const actions: ActionTree<NewTootState, RootState> = {
|
||||||
setupLoading: ({ commit }) => {
|
setupLoading: ({ dispatch }) => {
|
||||||
const axiosLoading = new AxiosLoading()
|
const axiosLoading = new AxiosLoading()
|
||||||
axiosLoading.on('start', (_: number) => {
|
axiosLoading.on('start', (_: number) => {
|
||||||
commit(MUTATION_TYPES.CHANGE_LOADING, true)
|
dispatch('startLoading')
|
||||||
})
|
})
|
||||||
axiosLoading.on('done', () => {
|
axiosLoading.on('done', () => {
|
||||||
commit(MUTATION_TYPES.CHANGE_LOADING, false)
|
dispatch('stopLoading')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
startLoading: ({ commit, state }) => {
|
||||||
|
if (state.modalOpen && !state.loading) {
|
||||||
|
commit(MUTATION_TYPES.CHANGE_LOADING, true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stopLoading: ({ commit, state }) => {
|
||||||
|
if (state.modalOpen && state.loading) {
|
||||||
|
commit(MUTATION_TYPES.CHANGE_LOADING, false)
|
||||||
|
}
|
||||||
|
},
|
||||||
updateMedia: async ({ rootState }, mediaDescription: MediaDescription) => {
|
updateMedia: async ({ rootState }, mediaDescription: MediaDescription) => {
|
||||||
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()
|
||||||
|
|
Loading…
Reference in New Issue