initial commit
This commit is contained in:
55
resources/js/store/dashboard/actions.js
vendored
Normal file
55
resources/js/store/dashboard/actions.js
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import axiosClient from '../../config/axios'
|
||||
import { isApiSuccess } from './../../helper'
|
||||
|
||||
|
||||
export const load = ({ commit }) => {
|
||||
return axiosClient
|
||||
.get('dashboard')
|
||||
.then(response => {
|
||||
|
||||
if (isApiSuccess(response)) {
|
||||
commit('SET_MERCHANTS', response.data.merchants)
|
||||
commit('SET_ANNOUNCEMENTS', response.data.announcements)
|
||||
}
|
||||
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
commit('SET_MERCHANTS', [])
|
||||
commit('SET_ANNOUNCEMENTS', [])
|
||||
console.log('Dashboard Data Load Exception: ', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const approveChargebackRequest = ({ commit }, payload) => {
|
||||
return axiosClient
|
||||
.post('chargeback/approve', payload)
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Approve Chargeback Request Exception: ', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const rejectChargebackRequest = ({ commit }, payload) => {
|
||||
return axiosClient
|
||||
.post('chargeback/reject', payload)
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Reject Chargeback Request Exception: ', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const refundRequest = ({ commit }, payload) => {
|
||||
return axiosClient
|
||||
.post('refundrequest', payload,{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Refund Request Exception: ', exception);
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user