feat: payment & customer
This commit is contained in:
@@ -3,11 +3,13 @@ import { configureStore } from '@reduxjs/toolkit'
|
||||
|
||||
import productReducer from '@/redux-store/slices/product'
|
||||
import customerReducer from '@/redux-store/slices/customer'
|
||||
import paymentMethodReducer from '@/redux-store/slices/paymentMethod'
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
productReducer,
|
||||
customerReducer
|
||||
customerReducer,
|
||||
paymentMethodReducer
|
||||
},
|
||||
middleware: getDefaultMiddleware => getDefaultMiddleware({ serializableCheck: false })
|
||||
})
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// Third-party Imports
|
||||
import type { PayloadAction } from '@reduxjs/toolkit'
|
||||
import { createSlice } from '@reduxjs/toolkit'
|
||||
|
||||
// Type Imports
|
||||
|
||||
// Data Imports
|
||||
import { PaymentMethod } from '../../types/services/paymentMethod'
|
||||
|
||||
const initialState: { currentPaymentMethod: PaymentMethod } = {
|
||||
currentPaymentMethod: {
|
||||
id: '',
|
||||
organization_id: '',
|
||||
name: '',
|
||||
type: '',
|
||||
is_active: true,
|
||||
created_at: '',
|
||||
updated_at: ''
|
||||
}
|
||||
}
|
||||
|
||||
export const paymentMethodSlice = createSlice({
|
||||
name: 'paymentMethod',
|
||||
initialState,
|
||||
reducers: {
|
||||
setPaymentMethod: (state, action: PayloadAction<PaymentMethod>) => {
|
||||
state.currentPaymentMethod = action.payload
|
||||
},
|
||||
resetPaymentMethod: state => {
|
||||
state.currentPaymentMethod = initialState.currentPaymentMethod
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export const { setPaymentMethod, resetPaymentMethod } = paymentMethodSlice.actions
|
||||
|
||||
export default paymentMethodSlice.reducer
|
||||
Reference in New Issue
Block a user