diff --git a/apps/client/src/common/api/ontimeApi.ts b/apps/client/src/common/api/ontimeApi.ts index e4e69311a..f883b988f 100644 --- a/apps/client/src/common/api/ontimeApi.ts +++ b/apps/client/src/common/api/ontimeApi.ts @@ -246,11 +246,6 @@ export const uploadSheetClientFile = async (file: File) => { .then((response) => response.data.id); }; -export const getSheetsAuthStatus = async () => { - const res = await axios.get(`${ontimeURL}/sheet-authstatus`); - return res.data; -}; - export const getSheetsAuthUrl = async () => { const res = await axios.get(`${ontimeURL}/sheet-authurl`); return res.data; @@ -299,6 +294,5 @@ export async function postSheetSettings(data: GoogleSheet): Promise */ export async function getSheetstate(): Promise { const res = await axios.get(`${ontimeURL}/sheet-state`); - console.log(res.data) return res.data; } \ No newline at end of file diff --git a/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx b/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx index 4719da72a..d80f54749 100644 --- a/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx +++ b/apps/client/src/features/modals/sheets-modal/SheetsModal.tsx @@ -9,7 +9,6 @@ import { ModalFooter, ModalHeader, ModalOverlay, - useDisclosure, } from '@chakra-ui/react'; import { IoCheckmarkCircleOutline } from '@react-icons/all-files/io5/IoCheckmarkCircleOutline'; import { IoCloseCircleOutline } from '@react-icons/all-files/io5/IoCloseCircleOutline'; @@ -20,7 +19,6 @@ import { OntimeRundown, ProjectData, UserFields, GoogleSheetState } from 'ontime import { PROJECT_DATA, RUNDOWN, USERFIELDS } from '../../../common/api/apiConstants'; import { maybeAxiosError } from '../../../common/api/apiUtils'; import { - getSheetsAuthStatus, getSheetsAuthUrl, patchData, postPreviewSheet, @@ -43,7 +41,6 @@ export default function SheetsModal(props: SheetsModalProps) { const { isOpen, onClose } = props; const fileInputRef = useRef(null); - const [authState, setAuthState] = useState(true); const [rundown, setRundown] = useState(null); const [userFields, setUserFields] = useState(null); @@ -107,6 +104,14 @@ export default function SheetsModal(props: SheetsModalProps) { }); }; + const handleAuthenticate = () => { + getSheetsAuthUrl().then((data) => { + if (data != 'bad') { + window.open(data, '_blank', 'noreferrer'); + } + }); + }; + const handlePullData = () => { postPreviewSheet(sheetid.current?.value ?? '', worksheet.current?.value ?? '').then((data) => { setProject(data.project); @@ -185,8 +190,10 @@ export default function SheetsModal(props: SheetsModalProps) {
- {authState &&
You are authenticated
} - {!authState &&
You are not authenticated
} + + {sheetState.auth ?
You are authenticated
:
You are not authenticated
}
{sheetState.worksheet ? : } -