mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 21:54:09 +00:00
remove unused
This commit is contained in:
@@ -246,11 +246,6 @@ export const uploadSheetClientFile = async (file: File) => {
|
|||||||
.then((response) => response.data.id);
|
.then((response) => response.data.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSheetsAuthStatus = async () => {
|
|
||||||
const res = await axios.get(`${ontimeURL}/sheet-authstatus`);
|
|
||||||
return res.data;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getSheetsAuthUrl = async () => {
|
export const getSheetsAuthUrl = async () => {
|
||||||
const res = await axios.get(`${ontimeURL}/sheet-authurl`);
|
const res = await axios.get(`${ontimeURL}/sheet-authurl`);
|
||||||
return res.data;
|
return res.data;
|
||||||
@@ -299,6 +294,5 @@ export async function postSheetSettings(data: GoogleSheet): Promise<GoogleSheet>
|
|||||||
*/
|
*/
|
||||||
export async function getSheetstate(): Promise<GoogleSheetState> {
|
export async function getSheetstate(): Promise<GoogleSheetState> {
|
||||||
const res = await axios.get(`${ontimeURL}/sheet-state`);
|
const res = await axios.get(`${ontimeURL}/sheet-state`);
|
||||||
console.log(res.data)
|
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
ModalFooter,
|
ModalFooter,
|
||||||
ModalHeader,
|
ModalHeader,
|
||||||
ModalOverlay,
|
ModalOverlay,
|
||||||
useDisclosure,
|
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { IoCheckmarkCircleOutline } from '@react-icons/all-files/io5/IoCheckmarkCircleOutline';
|
import { IoCheckmarkCircleOutline } from '@react-icons/all-files/io5/IoCheckmarkCircleOutline';
|
||||||
import { IoCloseCircleOutline } from '@react-icons/all-files/io5/IoCloseCircleOutline';
|
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 { PROJECT_DATA, RUNDOWN, USERFIELDS } from '../../../common/api/apiConstants';
|
||||||
import { maybeAxiosError } from '../../../common/api/apiUtils';
|
import { maybeAxiosError } from '../../../common/api/apiUtils';
|
||||||
import {
|
import {
|
||||||
getSheetsAuthStatus,
|
|
||||||
getSheetsAuthUrl,
|
getSheetsAuthUrl,
|
||||||
patchData,
|
patchData,
|
||||||
postPreviewSheet,
|
postPreviewSheet,
|
||||||
@@ -43,7 +41,6 @@ export default function SheetsModal(props: SheetsModalProps) {
|
|||||||
const { isOpen, onClose } = props;
|
const { isOpen, onClose } = props;
|
||||||
|
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
const [authState, setAuthState] = useState<boolean>(true);
|
|
||||||
|
|
||||||
const [rundown, setRundown] = useState<OntimeRundown | null>(null);
|
const [rundown, setRundown] = useState<OntimeRundown | null>(null);
|
||||||
const [userFields, setUserFields] = useState<UserFields | 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 = () => {
|
const handlePullData = () => {
|
||||||
postPreviewSheet(sheetid.current?.value ?? '', worksheet.current?.value ?? '').then((data) => {
|
postPreviewSheet(sheetid.current?.value ?? '', worksheet.current?.value ?? '').then((data) => {
|
||||||
setProject(data.project);
|
setProject(data.project);
|
||||||
@@ -185,8 +190,10 @@ export default function SheetsModal(props: SheetsModalProps) {
|
|||||||
<div>
|
<div>
|
||||||
<Button onClick={handleClick}>Upload Client Secrect</Button>
|
<Button onClick={handleClick}>Upload Client Secrect</Button>
|
||||||
</div>
|
</div>
|
||||||
{authState && <div>You are authenticated</div>}
|
<Button variant='ontime-filled' padding='0 2em' onClick={handleAuthenticate}>
|
||||||
{!authState && <div>You are not authenticated</div>}
|
Authenticate
|
||||||
|
</Button>
|
||||||
|
{sheetState.auth ? <div>You are authenticated</div> : <div>You are not authenticated</div>}
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor='sheetid'>Sheet ID </label>
|
<label htmlFor='sheetid'>Sheet ID </label>
|
||||||
<Input
|
<Input
|
||||||
@@ -211,7 +218,6 @@ export default function SheetsModal(props: SheetsModalProps) {
|
|||||||
variant='ontime-filled-on-light'
|
variant='ontime-filled-on-light'
|
||||||
/>
|
/>
|
||||||
{sheetState.worksheet ? <IoCheckmarkCircleOutline /> : <IoCloseCircleOutline />}
|
{sheetState.worksheet ? <IoCheckmarkCircleOutline /> : <IoCloseCircleOutline />}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button variant='ontime-filled' padding='0 2em' onClick={handlePullData}>
|
<Button variant='ontime-filled' padding='0 2em' onClick={handlePullData}>
|
||||||
|
|||||||
Reference in New Issue
Block a user