From e051b59a9874fa2c74ed1f848aa0c0caf76963fc Mon Sep 17 00:00:00 2001 From: FreezyEx Date: Thu, 13 Oct 2022 10:49:52 +0200 Subject: [PATCH] readded loading.js --- store/loading.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 store/loading.js diff --git a/store/loading.js b/store/loading.js new file mode 100644 index 0000000..d4039f0 --- /dev/null +++ b/store/loading.js @@ -0,0 +1,48 @@ +export const state = () => { + return { + message: '', + progress: '', + enabled: false, + type: null + } + } + + export const getters = {} + + export const mutations = { + ENABLE(state, { message, progress, type }) { + state.message = message + state.enabled = true + state.progress = progress + state.type = type + }, + DISABLE(state) { + state.message = '' + state.enabled = false + state.progress = '' + 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 }) + }, + updateProgress({ commit }, { message, progress }) { + commit('ENABLE', { message, progress }) + }, + disable({ commit }) { + commit('DISABLE') + }, + showConfirmLoader({ dispatch, rootState }) { + dispatch('changeText', { + message: this.app.i18n.t('pleaseConfirmTransactionInWallet', { + wallet: rootState.metamask.walletName + }), + type: 'approve' + }) + } + } \ No newline at end of file