mirror of
https://github.com/crater-invoice/crater.git
synced 2025-12-16 02:12:54 -05:00
fix status action in view invoice
This commit is contained in:
@@ -47,6 +47,7 @@ export const fetchViewInvoice = ({ commit, dispatch, state }, id) => {
|
||||
export const sendEmail = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/invoices/send`, data).then((response) => {
|
||||
commit(types.UPDATE_INVOICE_STATUS, {id: data.id, status: 'SENT'})
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
|
||||
@@ -14,3 +14,4 @@ export const SELECT_CUSTOMER = 'SELECT_CUSTOMER'
|
||||
export const RESET_SELECTED_CUSTOMER = 'RESET_SELECTED_CUSTOMER'
|
||||
export const SET_SELECT_ALL_STATE = 'SET_SELECT_ALL_STATE'
|
||||
export const RESET_SELECTED_INVOICES = 'RESET_SELECTED_INVOICES'
|
||||
export const UPDATE_INVOICE_STATUS = 'UPDATE_INVOICE_STATUS'
|
||||
|
||||
@@ -28,6 +28,12 @@ export default {
|
||||
state.invoices[pos] = data.invoice
|
||||
},
|
||||
|
||||
[types.UPDATE_INVOICE_STATUS] (state, data) {
|
||||
let pos = state.invoices.findIndex(invoice => invoice.id === data.id)
|
||||
|
||||
state.invoices[pos].status = data.status
|
||||
},
|
||||
|
||||
[types.RESET_SELECTED_INVOICES] (state, data) {
|
||||
state.selectedInvoices = []
|
||||
state.selectAllField = false
|
||||
|
||||
Reference in New Issue
Block a user