ijust addded getStockDetailsByVariantName

This commit is contained in:
Tamilselvan 2026-02-02 12:10:21 +05:30
parent 5b0328e5bc
commit 5fc555c67c
1 changed files with 26 additions and 25 deletions

View File

@ -18,6 +18,15 @@ export const getNotification = createAsyncThunk(
); );
} }
); );
export const getStockDetailsByVariantName = createAsyncThunk(
'BookingData/getStockDetailsByVariantName',
async (data) => {
return await axiosRetailInstanceData.post(
`/productVariantListByname`,
data
);
}
);
export const getLayoutCategories = createAsyncThunk( export const getLayoutCategories = createAsyncThunk(
'BookingData/getLayoutCategories', 'BookingData/getLayoutCategories',
@ -787,37 +796,34 @@ export const getPaymentOptionFeatureApi = createAsyncThunk(
); );
export const getProductsearch = createAsyncThunk( export const getProductsearch = createAsyncThunk(
"BookingData/getProductsearch", 'BookingData/getProductsearch',
async ( async (
{ CompId, BranchId, AppId, ProdName }, { CompId, BranchId, AppId, ProdName },
{ signal, rejectWithValue } { signal, rejectWithValue }
) => { ) => {
try { try {
if (!CompId || !BranchId || !AppId || !ProdName) { if (!CompId || !BranchId || !AppId || !ProdName) {
return rejectWithValue("Invalid params"); return rejectWithValue('Invalid params');
} }
const response = await axiosRetailInstanceData.get( const response = await axiosRetailInstanceData.get(`/productCardList`, {
`/productCardList`, params: {
{ CompId,
params: { BranchId,
CompId, AppId,
BranchId, ProdName,
AppId, },
ProdName, signal, // ✅ Abort works here
}, });
signal, // ✅ Abort works here
}
);
return response.data; // ✅ return only data return response.data; // ✅ return only data
} catch (error) { } catch (error) {
// ✅ Abort error ignore // ✅ Abort error ignore
if (error.name === "CanceledError" || error.name === "AbortError") { if (error.name === 'CanceledError' || error.name === 'AbortError') {
throw error; throw error;
} }
return rejectWithValue(error.response?.data || "API Error"); return rejectWithValue(error.response?.data || 'API Error');
} }
} }
); );
@ -1423,7 +1429,7 @@ export const getMissedOrderids = createAsyncThunk(
export const CustomerOrderList = createAsyncThunk( export const CustomerOrderList = createAsyncThunk(
'CustomerOrderList/LastBuyProductList', 'CustomerOrderList/LastBuyProductList',
async (data) => { async (data) => {
const { AppId, CompId, BranchId, MobileNo,FromDate,ToDate } = data; const { AppId, CompId, BranchId, MobileNo, FromDate, ToDate } = data;
if ( if (
AppId != null && AppId != null &&
AppId != undefined && AppId != undefined &&
@ -1441,8 +1447,7 @@ export const CustomerOrderList = createAsyncThunk(
return await axiosRetailInstanceData.get( return await axiosRetailInstanceData.get(
`/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}&fromDate=${FromDate}&toDate=${ToDate}` `/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}&fromDate=${FromDate}&toDate=${ToDate}`
); );
} } else if (
else if (
AppId != null && AppId != null &&
AppId != undefined && AppId != undefined &&
CompId != null && CompId != null &&
@ -1456,7 +1461,6 @@ export const CustomerOrderList = createAsyncThunk(
`/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}` `/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}`
); );
} }
} }
); );
@ -1477,8 +1481,6 @@ export const getmultipleSearch = createAsyncThunk(
} }
); );
const initialState = { const initialState = {
PrintStyle: null, PrintStyle: null,
CustId: null, CustId: null,
@ -1967,9 +1969,8 @@ const BookingData = createSlice({
state.SelectedDatas = []; state.SelectedDatas = [];
} }
}), }),
builder.addCase(getProductsearch.fulfilled, (state, action) => {
builder.addCase(getProductsearch.fulfilled, (state, action) => { console.log(action?.payload, 'mohanaacacacca');
console.log(action?.payload,"mohanaacacacca")
if (action?.payload?.statusCode === 1) { if (action?.payload?.statusCode === 1) {
state.SelectedDatas = action?.payload?.data; state.SelectedDatas = action?.payload?.data;
} else { } else {