inital commit
This commit is contained in:
105
resources/js/store/auth/actions.js
vendored
Normal file
105
resources/js/store/auth/actions.js
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
import axiosClient from '@/config/axios'
|
||||
import { removeToken, isApiSuccess, setToken, setRefreshToken, getRefreshToken } from '@/helper'
|
||||
|
||||
|
||||
export const login = ({ commit }, formData) => {
|
||||
return axiosClient
|
||||
.post('login', formData)
|
||||
.then(response => {
|
||||
|
||||
if (isApiSuccess(response)) {
|
||||
commit('SET_USER', response.data.user)
|
||||
commit('SET_AUTHENTICATED', false)
|
||||
}
|
||||
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
commit('SET_USER', {})
|
||||
commit('SET_AUTHENTICATED', false)
|
||||
console.log('Login Action Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const verifyOTP = ({ commit }, formData) => {
|
||||
return axiosClient.post('verifysms', formData)
|
||||
.then(response => {
|
||||
|
||||
if (isApiSuccess(response)) {
|
||||
commit('SET_AUTHENTICATED', true)
|
||||
|
||||
setToken(response.data.access_token)
|
||||
setRefreshToken(response.data.refresh_token)
|
||||
}
|
||||
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('verifyOTP Action Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const authenticateWithRefreshToken = ({ commit }) => {
|
||||
return axiosClient.post('refreshtoken', { refresh_token: getRefreshToken() })
|
||||
.then(response => {
|
||||
|
||||
if (isApiSuccess(response)) {
|
||||
commit('SET_AUTHENTICATED', true)
|
||||
|
||||
setToken(response.data.access_token)
|
||||
setRefreshToken(response.data.refresh_token)
|
||||
}
|
||||
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('authenticateWithRefreshToken Action Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const resendOTP = ({ commit }, formData) => {
|
||||
return axiosClient.post('resendotp', formData)
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Login Action Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const authUser = ({ commit }) => {
|
||||
return axiosClient.get('get-authinfo')
|
||||
.then(response => {
|
||||
commit('SET_AUTHENTICATED', true)
|
||||
commit('SET_USER', response.data.user)
|
||||
commit('SET_PERMISSIONS', response.data.permissions)
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Get Auth User Action Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const logout = ({ commit }) => {
|
||||
commit('SET_USER', {})
|
||||
commit('SET_AUTHENTICATED', false)
|
||||
removeToken()
|
||||
}
|
||||
|
||||
export const setLoader = ({ commit }, status) => {
|
||||
commit('SET_LOADER', status)
|
||||
}
|
||||
|
||||
export const loadPermissions = ({ commit }) => {
|
||||
return axiosClient
|
||||
.get('getpermission')
|
||||
.then(response => {
|
||||
commit('SET_PERMISSIONS', response.data.permissions)
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Permissions API Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const isModalShow = ({ commit }, status) => {
|
||||
commit('SHOW_MODAL', status)
|
||||
}
|
||||
|
||||
export const userFormData = ({ commit }, value) => {
|
||||
commit('SET_USER_FORM_DATA', value)
|
||||
}
|
||||
22
resources/js/store/auth/getters.js
vendored
Normal file
22
resources/js/store/auth/getters.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export const authenticated = (state) => {
|
||||
return state.authenticated
|
||||
}
|
||||
|
||||
export const user = (state) => {
|
||||
return state.user
|
||||
}
|
||||
|
||||
export const getLoaderStatus = (state) => {
|
||||
return state.loader;
|
||||
}
|
||||
|
||||
export const getPermissions = (state) => {
|
||||
return state.permissions;
|
||||
}
|
||||
|
||||
export const getModalShowStatus = (state) => {
|
||||
return state.isModalShow;
|
||||
}
|
||||
export const getUserFormData = (state) => {
|
||||
return state.userFormData;
|
||||
}
|
||||
12
resources/js/store/auth/index.js
vendored
Normal file
12
resources/js/store/auth/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
|
||||
}
|
||||
22
resources/js/store/auth/mutations.js
vendored
Normal file
22
resources/js/store/auth/mutations.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export const SET_AUTHENTICATED = (state, value) => {
|
||||
state.authenticated = value
|
||||
}
|
||||
export const SET_USER = (state, value) => {
|
||||
state.user = value
|
||||
}
|
||||
|
||||
export const SET_LOADER = (state, value) => {
|
||||
state.loader = value
|
||||
}
|
||||
|
||||
export const SET_PERMISSIONS = (state, value) => {
|
||||
state.permissions = value
|
||||
}
|
||||
|
||||
export const SHOW_MODAL = (state, value) => {
|
||||
state.isModalShow = value
|
||||
}
|
||||
|
||||
export const SET_USER_FORM_DATA = (state, value) => {
|
||||
state.userFormData = value
|
||||
}
|
||||
8
resources/js/store/auth/state.js
vendored
Normal file
8
resources/js/store/auth/state.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
authenticated: false,
|
||||
user: {},
|
||||
permissions: {},
|
||||
loader: false,
|
||||
isModalShow: false,
|
||||
userFormData: {}
|
||||
}
|
||||
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: []
|
||||
}
|
||||
51
resources/js/store/global/actions.js
vendored
Normal file
51
resources/js/store/global/actions.js
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import axiosClient from '@/config/axios'
|
||||
|
||||
export const loadMerchants = ({ commit }, filter_data) => {
|
||||
return axiosClient
|
||||
.post('merchantlist', filter_data)
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Merchants API Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const allTransactions = ({ commit }, filter_data) => {
|
||||
return axiosClient
|
||||
.post('alltransaction', filter_data)
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('All Transaction API Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const loadRefundedTransactions = ({ commit }, filter_data) => {
|
||||
return axiosClient
|
||||
.post('refundedtransaction', filter_data)
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Refunded API Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const loadChargebackTransactions = ({ commit }, filter_data) => {
|
||||
return axiosClient
|
||||
.get('chargeback/list', { params: filter_data })
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Chargeback API Exception', exception);
|
||||
})
|
||||
}
|
||||
|
||||
export const loadIntegratorInformation = () => {
|
||||
return axiosClient
|
||||
.get('integratorinfo')
|
||||
.then(response => {
|
||||
return Promise.resolve(response)
|
||||
}).catch(exception => {
|
||||
console.log('Integrator Information API Exception', exception);
|
||||
})
|
||||
}
|
||||
0
resources/js/store/global/getters.js
vendored
Normal file
0
resources/js/store/global/getters.js
vendored
Normal file
12
resources/js/store/global/index.js
vendored
Normal file
12
resources/js/store/global/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
|
||||
}
|
||||
0
resources/js/store/global/mutations.js
vendored
Normal file
0
resources/js/store/global/mutations.js
vendored
Normal file
1
resources/js/store/global/state.js
vendored
Normal file
1
resources/js/store/global/state.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default {}
|
||||
13
resources/js/store/index.js
vendored
Normal file
13
resources/js/store/index.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { createStore } from 'vuex';
|
||||
|
||||
import auth from "./auth";
|
||||
import dashboard from "./dashboard";
|
||||
import global from "./global";
|
||||
|
||||
export default createStore({
|
||||
modules: {
|
||||
auth,
|
||||
dashboard,
|
||||
global
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user