remove unused

This commit is contained in:
arc-alex
2023-11-23 17:55:22 +01:00
parent 28533464d4
commit 5bc2c2f241
2 changed files with 12 additions and 12 deletions
-6
View File
@@ -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<GoogleSheet>
*/
export async function getSheetstate(): Promise<GoogleSheetState> {
const res = await axios.get(`${ontimeURL}/sheet-state`);
console.log(res.data)
return res.data;
}
@@ -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<HTMLInputElement>(null);
const [authState, setAuthState] = useState<boolean>(true);
const [rundown, setRundown] = useState<OntimeRundown | null>(null);
const [userFields, setUserFields] = useState<UserFields | null>(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) {
<div>
<Button onClick={handleClick}>Upload Client Secrect</Button>
</div>
{authState && <div>You are authenticated</div>}
{!authState && <div>You are not authenticated</div>}
<Button variant='ontime-filled' padding='0 2em' onClick={handleAuthenticate}>
Authenticate
</Button>
{sheetState.auth ? <div>You are authenticated</div> : <div>You are not authenticated</div>}
<div>
<label htmlFor='sheetid'>Sheet ID </label>
<Input
@@ -211,7 +218,6 @@ export default function SheetsModal(props: SheetsModalProps) {
variant='ontime-filled-on-light'
/>
{sheetState.worksheet ? <IoCheckmarkCircleOutline /> : <IoCloseCircleOutline />}
</div>
<div>
<Button variant='ontime-filled' padding='0 2em' onClick={handlePullData}>