push to sheet

This commit is contained in:
arc-alex
2023-11-19 17:04:14 +01:00
parent a7c9ce876c
commit 543e365f82
5 changed files with 162 additions and 41 deletions
+11
View File
@@ -265,3 +265,14 @@ export const postPreviewSheet = async (sheetId: string, worksheet: string, optio
});
return response.data.data;
};
export const postPushSheet = async (sheetId: string, worksheet: string, options?: ExcelImportMap) => {
const response = await axios.post(`${ontimeURL}/sheet-push`, {
sheetid: sheetId,
worksheet: worksheet,
options: options,
});
return response.data.data;
};
@@ -17,6 +17,7 @@ import {
postPreviewSheet,
uploadSheetClientFile,
patchData,
postPushSheet,
} from '../../../common/api/ontimeApi';
import { OntimeRundown, ProjectData, UserFields } from 'ontime-types';
@@ -88,6 +89,12 @@ export default function SheetsModal(props: SheetsModalProps) {
});
};
const handlePushData = () => {
postPushSheet(sheetid.current?.value ?? '', worksheet.current?.value ?? '').then((data) => {
console.log(data);
});
};
const handleFinalise = async () => {
// this step is currently only used for excel files, after preview
if (rundown && userFields && project) {
@@ -181,6 +188,9 @@ export default function SheetsModal(props: SheetsModalProps) {
<Button variant='ontime-filled' padding='0 2em' onClick={handlePullData}>
Pull data
</Button>
<Button variant='ontime-filled' padding='0 2em' onClick={handlePushData}>
Push data
</Button>
</div>
</>
)}