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);
|
||||
})
|
||||
}
|
||||
11
resources/js/store/dashboard/getters.js
vendored
Normal file
11
resources/js/store/dashboard/getters.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export const merchants = (state) => {
|
||||
return state.merchants
|
||||
}
|
||||
|
||||
export const announcements = (state) => {
|
||||
return state.announcements
|
||||
}
|
||||
|
||||
export const getSidebarMenuItems = (state) => {
|
||||
return state.sidebar_menu_items
|
||||
}
|
||||
12
resources/js/store/dashboard/index.js
vendored
Normal file
12
resources/js/store/dashboard/index.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import state from "./state";
|
||||
import * as getters from "./getters";
|
||||
import * as mutations from "./mutations";
|
||||
import * as actions from "./actions";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
13
resources/js/store/dashboard/mutations.js
vendored
Normal file
13
resources/js/store/dashboard/mutations.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { generateSidebarMenuItems } from "@/helper"
|
||||
|
||||
export const SET_MERCHANTS = (state, value) => {
|
||||
state.merchants = value
|
||||
}
|
||||
|
||||
export const SET_ANNOUNCEMENTS = (state, value) => {
|
||||
state.announcements = value
|
||||
}
|
||||
|
||||
export const SET_SIDEBAR_MENU_ITEMS = (state) => {
|
||||
state.sidebar_menu_items = generateSidebarMenuItems()
|
||||
}
|
||||
5
resources/js/store/dashboard/state.js
vendored
Normal file
5
resources/js/store/dashboard/state.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default {
|
||||
merchants: [],
|
||||
announcements: [],
|
||||
sidebar_menu_items: []
|
||||
}
|
||||
Reference in New Issue
Block a user