feat: analytic
This commit is contained in:
@@ -4,12 +4,14 @@ 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'
|
||||
import ingredientReducer from '@/redux-store/slices/ingredient'
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
productReducer,
|
||||
customerReducer,
|
||||
paymentMethodReducer
|
||||
paymentMethodReducer,
|
||||
ingredientReducer
|
||||
},
|
||||
middleware: getDefaultMiddleware => getDefaultMiddleware({ serializableCheck: false })
|
||||
})
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// Third-party Imports
|
||||
import type { PayloadAction } from '@reduxjs/toolkit'
|
||||
import { createSlice } from '@reduxjs/toolkit'
|
||||
|
||||
// Type Imports
|
||||
|
||||
// Data Imports
|
||||
import { IngredientItem } from '../../types/services/ingredient'
|
||||
|
||||
const initialState: { currentIngredient: IngredientItem } = {
|
||||
currentIngredient: {
|
||||
id: '',
|
||||
organization_id: '',
|
||||
outlet_id: '',
|
||||
name: '',
|
||||
unit_id: '',
|
||||
cost: 0,
|
||||
stock: 0,
|
||||
is_semi_finished: false,
|
||||
is_active: true,
|
||||
metadata: {},
|
||||
created_at: '',
|
||||
updated_at: '',
|
||||
unit: {
|
||||
id: '',
|
||||
organization_id: '',
|
||||
outlet_id: '',
|
||||
name: '',
|
||||
abbreviation: '',
|
||||
is_active: false,
|
||||
created_at: '',
|
||||
updated_at: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const ingredientSlice = createSlice({
|
||||
name: 'ingredient',
|
||||
initialState,
|
||||
reducers: {
|
||||
setIngredient: (state, action: PayloadAction<IngredientItem>) => {
|
||||
state.currentIngredient = action.payload
|
||||
},
|
||||
resetIngredient: state => {
|
||||
state.currentIngredient = initialState.currentIngredient
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export const { setIngredient, resetIngredient } = ingredientSlice.actions
|
||||
|
||||
export default ingredientSlice.reducer
|
||||
Reference in New Issue
Block a user