2022-04-22 06:05:56 +03:00
|
|
|
export const state = () => {
|
|
|
|
return {
|
|
|
|
message: '',
|
2022-10-13 17:33:49 +03:00
|
|
|
progress: -1,
|
2022-04-22 06:05:56 +03:00
|
|
|
enabled: false,
|
|
|
|
type: null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const getters = {}
|
|
|
|
|
|
|
|
export const mutations = {
|
2022-10-13 17:33:49 +03:00
|
|
|
ENABLE(state, { message, progress, type }) {
|
2022-04-22 06:05:56 +03:00
|
|
|
state.message = message
|
|
|
|
state.enabled = true
|
2022-10-13 17:33:49 +03:00
|
|
|
state.progress = progress
|
2022-04-22 06:05:56 +03:00
|
|
|
state.type = type
|
|
|
|
},
|
|
|
|
DISABLE(state) {
|
|
|
|
state.message = ''
|
|
|
|
state.enabled = false
|
2022-10-13 17:33:49 +03:00
|
|
|
state.progress = -1
|
2022-04-22 06:05:56 +03:00
|
|
|
state.type = null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const actions = {
|
|
|
|
enable({ commit }, { message = this.app.i18n.t('loading') }) {
|
|
|
|
commit('ENABLE', { message })
|
|
|
|
},
|
|
|
|
changeText({ commit }, { message, type }) {
|
|
|
|
commit('ENABLE', { message, type })
|
|
|
|
},
|
2022-10-13 17:33:49 +03:00
|
|
|
updateProgress({ commit }, { message, progress }) {
|
|
|
|
commit('ENABLE', { message, progress })
|
|
|
|
},
|
2022-04-22 06:05:56 +03:00
|
|
|
disable({ commit }) {
|
|
|
|
commit('DISABLE')
|
|
|
|
},
|
|
|
|
showConfirmLoader({ dispatch, rootState }) {
|
|
|
|
dispatch('changeText', {
|
|
|
|
message: this.app.i18n.t('pleaseConfirmTransactionInWallet', {
|
|
|
|
wallet: rootState.metamask.walletName
|
|
|
|
}),
|
|
|
|
type: 'approve'
|
|
|
|
})
|
|
|
|
}
|
2022-10-13 17:33:49 +03:00
|
|
|
}
|