Vendor Slice

This commit is contained in:
efrilm
2025-09-12 14:02:57 +07:00
parent 3a74e32e64
commit c91be1812b
3 changed files with 47 additions and 2 deletions
+3 -1
View File
@@ -9,6 +9,7 @@ import orderReducer from '@/redux-store/slices/order'
import productRecipeReducer from '@/redux-store/slices/productRecipe'
import organizationReducer from '@/redux-store/slices/organization'
import userReducer from '@/redux-store/slices/user'
import vendorReducer from '@/redux-store/slices/vendor'
export const store = configureStore({
reducer: {
@@ -19,7 +20,8 @@ export const store = configureStore({
orderReducer,
productRecipeReducer,
organizationReducer,
userReducer
userReducer,
vendorReducer
},
middleware: getDefaultMiddleware => getDefaultMiddleware({ serializableCheck: false })
})
+43
View File
@@ -0,0 +1,43 @@
// Third-party Imports
import type { PayloadAction } from '@reduxjs/toolkit'
import { createSlice } from '@reduxjs/toolkit'
// Type Imports
// Data Imports
import { Vendor } from '../../types/services/vendor'
const initialState: { currentVendor: Vendor } = {
currentVendor: {
id: '',
organization_id: '',
name: '',
email: '',
phone_number: '',
address: '',
contact_person: '',
tax_number: '',
payment_terms: '',
notes: '',
is_active: true,
created_at: '',
updated_at: ''
}
}
export const VendorSlice = createSlice({
name: 'vendor',
initialState,
reducers: {
setVendor: (state, action: PayloadAction<Vendor>) => {
state.currentVendor = action.payload
},
resetVendor: state => {
state.currentVendor = initialState.currentVendor
}
}
})
export const { setVendor, resetVendor } = VendorSlice.actions
export default VendorSlice.reducer