mirror of
https://github.com/crater-invoice/crater.git
synced 2025-12-17 02:42:54 -05:00
init crater
This commit is contained in:
28
resources/assets/js/store/modules/modal/actions.js
Normal file
28
resources/assets/js/store/modules/modal/actions.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as types from './mutation-types'
|
||||
|
||||
export const openModal = ({ commit, dispatch, state }, payload) => {
|
||||
commit(types.SET_COMPONENT_NAME, payload.componentName)
|
||||
commit(types.SHOW_MODAL, true)
|
||||
|
||||
if (payload.id) {
|
||||
commit(types.SET_ID, payload.id)
|
||||
}
|
||||
commit(types.SET_TITLE, payload.title)
|
||||
|
||||
if (payload.data) {
|
||||
commit(types.SET_DATA, payload.data)
|
||||
}
|
||||
|
||||
if (payload.size) {
|
||||
commit(types.SET_SIZE, payload.size)
|
||||
}
|
||||
}
|
||||
|
||||
export const closeModal = ({ commit, dispatch, state }) => {
|
||||
commit(types.RESET_DATA)
|
||||
commit(types.HIDE_MODAL, false)
|
||||
}
|
||||
|
||||
export const resetModalData = ({ commit, dispatch, state }) => {
|
||||
commit(types.RESET_DATA)
|
||||
}
|
||||
Reference in New Issue
Block a user