Android_Retail/src/Features/SupplierProductMapping/SupplierProductMapping.js

35 lines
2.2 KiB
JavaScript

import { createAsyncThunk } from "@reduxjs/toolkit";
import { axiosRetailInstanceData } from "../AuthenicationToken/AuthenticationToken";
export const getSupplaierProducts = createAsyncThunk('ReadyforSalesPost',async(data) => {
const {CompId,BranchId,AppId} = data;
if(CompId !== undefined && CompId !== null && BranchId !== undefined && BranchId !== null && AppId !== undefined && AppId !== null ){
return await axiosRetailInstanceData.get(`/SupplierProductMapping?compId=${CompId}&branchId=${BranchId}&appId=${AppId}`)
}
});
export const getSupplaierIdBasedProducts = createAsyncThunk('ReadyforSalesPost',async(data) =>{
const {CompId,BranchId,AppId,SuppId} = data;
if(CompId !== undefined && CompId !== null && BranchId !== undefined && BranchId !== null && AppId !== undefined && AppId !== null && SuppId !== undefined && SuppId !== null){
return await axiosRetailInstanceData.get(`/SupplierProductMapping/SupplierProducts?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&suppId=${SuppId}`)
}
});
export const getSupplaierIdwithTypeBasedProducts = createAsyncThunk('ReadyforSalesPost',async(data) =>{
const {CompId,BranchId,AppId,SuppId,LocationType} = data;
if(CompId !== undefined && CompId !== null && BranchId !== undefined && BranchId !== null && AppId !== undefined && AppId !== null && SuppId !== undefined && SuppId !== null&& LocationType !== undefined && LocationType !== null ){
return await axiosRetailInstanceData.get(`/SupplierProductMapping/SupplierProducts?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&suppId=${SuppId}&type=P&locationType=${LocationType}`)
}
});
export const postSupplaierProducts = createAsyncThunk('ReadyforSalesPost',async(data) =>{
return await axiosRetailInstanceData.post(`/SupplierProductMapping`,data)
});
export const deactivateSupplaierProduct = createAsyncThunk('ReadyforSalesPost',async(data) =>{
const {uniqueId,updatedBy,activeStatus} = data;
if(uniqueId !== undefined && uniqueId !== null && updatedBy !== undefined && updatedBy !== null && activeStatus !== undefined && activeStatus !== null ){
return await axiosRetailInstanceData.delete(`/SupplierProductMapping?uniqueId=${uniqueId}&updatedBy=${updatedBy}&activeStatus=${activeStatus}`)
}
});