diff --git a/apps/client/src/common/api/ontimeApi.ts b/apps/client/src/common/api/ontimeApi.ts index f883b988f..9c2337d10 100644 --- a/apps/client/src/common/api/ontimeApi.ts +++ b/apps/client/src/common/api/ontimeApi.ts @@ -251,21 +251,13 @@ export const getSheetsAuthUrl = async () => { return res.data; }; -export const postPreviewSheet = async (sheetId: string, worksheet: string, options?: ExcelImportMap) => { - const response = await axios.post(`${ontimeURL}/sheet-preview`, { - sheetid: sheetId, - worksheet: worksheet, - options: options, - }); +export const postPreviewSheet = async () => { + const response = await axios.post(`${ontimeURL}/sheet-preview`); 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, - }); +export const postPushSheet = async () => { + const response = await axios.post(`${ontimeURL}/sheet-push`); return response.data.data; }; diff --git a/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx b/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx index cba526e6c..ccd11cf7e 100644 --- a/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx +++ b/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx @@ -13,7 +13,7 @@ import { import { IoCheckmarkCircleOutline } from '@react-icons/all-files/io5/IoCheckmarkCircleOutline'; import { IoCloseCircleOutline } from '@react-icons/all-files/io5/IoCloseCircleOutline'; import { useQueryClient } from '@tanstack/react-query'; -import { GoogleSheetState,OntimeRundown, ProjectData, UserFields } from 'ontime-types'; +import { GoogleSheetState, OntimeRundown, ProjectData, UserFields } from 'ontime-types'; import { PROJECT_DATA, RUNDOWN, USERFIELDS } from '../../../common/api/apiConstants'; import { maybeAxiosError } from '../../../common/api/apiUtils'; @@ -56,19 +56,19 @@ export default function SheetsModal(props: SheetsModalProps) { setRundown(null); setProject(null); setUserFields(null); - // setSheetState({ auth: false, id: false, worksheet: false }); onClose(); }; const handleClick = () => { fileInputRef.current?.click(); }; - const handleFile = (event: ChangeEvent) => { + const handleFile = async (event: ChangeEvent) => { const selectedFile = event?.target?.files?.[0]; if (!selectedFile) { return; } else { - uploadSheetClientFile(selectedFile); + await uploadSheetClientFile(selectedFile); + _onChange(); } }; @@ -112,7 +112,7 @@ export default function SheetsModal(props: SheetsModalProps) { }; const handlePullData = () => { - postPreviewSheet(sheetid.current?.value ?? '', worksheet.current?.value ?? '').then((data) => { + postPreviewSheet().then((data) => { setProject(data.project); setRundown(data.rundown); setUserFields(data.userFields); @@ -120,7 +120,7 @@ export default function SheetsModal(props: SheetsModalProps) { }; const handlePushData = () => { - postPushSheet(sheetid.current?.value ?? '', worksheet.current?.value ?? '').then((data) => { + postPushSheet().then((data) => { console.log(data); }); }; @@ -218,18 +218,20 @@ export default function SheetsModal(props: SheetsModalProps) { /> {sheetState.worksheet ? : } -
- - -
)} + {!rundown && ( +
+ + +
+ )} {!rundown && (