51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
import { axiosRetailInstanceData } from '../AuthenicationToken/AuthenticationToken';
|
|
|
|
export const getStockNames = createAsyncThunk(
|
|
'StockPriceUpdate/getStockNames',
|
|
async (data) => {
|
|
if (
|
|
data?.CompId != null &&
|
|
data?.CompId != undefined &&
|
|
data?.BranchId != null &&
|
|
data?.BranchId != undefined &&
|
|
data?.AppId != null &&
|
|
data?.AppId != undefined
|
|
) {
|
|
return await axiosRetailInstanceData.get(
|
|
`/InwardPriceUpdate?Input.appId=${data?.AppId}&Input.compId=${data?.CompId}&Input.branchId=${data?.BranchId}`
|
|
);
|
|
}
|
|
}
|
|
);
|
|
|
|
export const PutStockPrice = createAsyncThunk(
|
|
'BookingData/PutStockPrice',
|
|
async (putData) => {
|
|
return await axiosRetailInstanceData.put(`/InwardPriceUpdate`, putData);
|
|
}
|
|
);
|
|
|
|
export const bulkPriceUpdate = createAsyncThunk(
|
|
'StockPriceUpdate/bulkPriceUpdate',
|
|
async (putData) => {
|
|
return await axiosRetailInstanceData.put(
|
|
`/priceChange`,
|
|
putData
|
|
);
|
|
}
|
|
);
|
|
|
|
const initialState = {
|
|
StockNames: [],
|
|
};
|
|
|
|
const StockPriceUpdate = createSlice({
|
|
name: 'StockPriceUpdate',
|
|
initialState,
|
|
});
|
|
|
|
export const settingDataSelector = (state) => state.settingPage?.settingData;
|
|
|
|
export default StockPriceUpdate.reducer;
|