PHP Classes

File: src/store/modules/global.js

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   WP Emailer   src/store/modules/global.js   Download  
File: src/store/modules/global.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: WP Emailer
Allow WordPress users to configure email settings
Author: By
Last change:
Date: 1 year ago
Size: 1,224 bytes
 

Contents

Class file image Download
// initial state const state = () => ({ alert: { isVisible: false, message : '', type : 'default' } }); // getters const getters = { alert : state => state.alert, }; // actions const actions = { setAlert({ commit }, alert) { commit('setAlert', alert); // Hide the success alert after 5 seconds. if ('success' === alert.type) { setTimeout(() => { commit('hideAlert'); }, 5000); } }, showAlert({ commit }) { commit('setIsAlertVisible', true); }, hideAlert({ commit }) { commit('hideAlert', false); }, }; // mutations const mutations = { setAlert: (state, alert) => { state.alert = { ...state.alert, isVisible: true, ...alert }; }, hideAlert: (state) => { state.alert = { isVisible: false, message : '', type : 'default' }; }, setIsAlertVisible: (state, isVisible) => { state.alert = { ...state.alert, isVisible }; }, }; export default { state, getters, actions, mutations };