74 lines
2.1 KiB
JavaScript
74 lines
2.1 KiB
JavaScript
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
import { axiosRetailInstanceData } from '../AuthenicationToken/AuthenticationToken';
|
|
|
|
// Get all table mappings
|
|
export const getTableMappings = createAsyncThunk(
|
|
'TableMapping/getTableMappings',
|
|
async ({ CompId, BranchId, AppId }) => {
|
|
if (
|
|
CompId != null &&
|
|
CompId != undefined &&
|
|
BranchId != null &&
|
|
BranchId != undefined &&
|
|
AppId != null &&
|
|
AppId != undefined
|
|
) {
|
|
return await axiosRetailInstanceData.get(
|
|
`/DiningTableMapping?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}`
|
|
);
|
|
}
|
|
}
|
|
);
|
|
|
|
// Create new table mapping
|
|
export const postTableMapping = createAsyncThunk(
|
|
'TableMapping/postTableMapping',
|
|
async (postData) => {
|
|
return await axiosRetailInstanceData.post(`/DiningTableMapping`, postData);
|
|
}
|
|
);
|
|
|
|
// Update existing table mapping
|
|
export const putTableMapping = createAsyncThunk(
|
|
'TableMapping/putTableMapping',
|
|
async (putData) => {
|
|
return await axiosRetailInstanceData.put(`/DiningTableMapping`, putData);
|
|
}
|
|
);
|
|
|
|
// Delete table mapping
|
|
export const deleteTableMapping = createAsyncThunk(
|
|
'TableMapping/deleteTableMapping',
|
|
async (deleteData) => {
|
|
if (
|
|
deleteData?.uniqueId &&
|
|
deleteData?.ActiveStatus
|
|
) {
|
|
return await axiosRetailInstanceData.delete(
|
|
`/DiningTableMapping?uniqueId=${deleteData?.uniqueId}&ActiveStatus=${deleteData?.ActiveStatus}`
|
|
);
|
|
}
|
|
}
|
|
);
|
|
// DiningTableMapping?request.uniqueId=43&request.activeStatus=A
|
|
// Get mappings by waiter
|
|
export const getTableMappingsByWaiter = createAsyncThunk(
|
|
'TableMapping/getTableMappingsByWaiter',
|
|
async ({ CompId, BranchId, AppId, WaiterId }) => {
|
|
if (
|
|
CompId != null &&
|
|
CompId != undefined &&
|
|
BranchId != null &&
|
|
BranchId != undefined &&
|
|
AppId != null &&
|
|
AppId != undefined &&
|
|
WaiterId != null &&
|
|
WaiterId != undefined
|
|
) {
|
|
return await axiosRetailInstanceData.get(
|
|
`/tableMapping/waiter?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}&WaiterId=${WaiterId}`
|
|
);
|
|
}
|
|
}
|
|
);
|