mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 03:13:47 +00:00
dont save sheet settings
This commit is contained in:
@@ -9,7 +9,6 @@ export const HTTP_SETTINGS = ['httpSettings'];
|
||||
export const APP_SETTINGS = ['appSettings'];
|
||||
export const VIEW_SETTINGS = ['viewSettings'];
|
||||
export const RUNTIME = ['runtimeStore'];
|
||||
export const SHEET = ['sheet'];
|
||||
export const SHEET_STATE = ['sheetState'];
|
||||
|
||||
const location = window.location;
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
OscSubscription,
|
||||
ProjectData,
|
||||
Settings,
|
||||
Sheet,
|
||||
SheetState,
|
||||
UserFields,
|
||||
ViewSettings,
|
||||
@@ -270,39 +269,28 @@ export const getSheetsAuthUrl = async () => {
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const postPreviewSheet = async () => {
|
||||
const response = await axios.post(`${ontimeURL}/sheet-preview`);
|
||||
export const postPreviewSheet = async (id: string, worksheet: string) => {
|
||||
const response = await axios.post(`${ontimeURL}/sheet-preview`, { id, worksheet });
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
export const postPushSheet = async () => {
|
||||
const response = await axios.post(`${ontimeURL}/sheet-push`);
|
||||
export const postPushSheet = async (id: string, worksheet: string) => {
|
||||
const response = await axios.post(`${ontimeURL}/sheet-push`, { id, worksheet });
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description HTTP request to retrieve sheets settings
|
||||
* @return {Promise}
|
||||
*/
|
||||
export async function getSheetSettings(): Promise<Sheet> {
|
||||
const res = await axios.get(`${ontimeURL}/sheet-settings`);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description HTTP request to mutate sheets settings
|
||||
* @return {Promise}
|
||||
*/
|
||||
export async function postSheetSettings(data: Sheet): Promise<Sheet> {
|
||||
const res = await axios.post(`${ontimeURL}/sheet-settings`, data);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description HTTP request to retrieve sheets state
|
||||
* @return {Promise}
|
||||
*/
|
||||
export async function getSheetState(): Promise<SheetState> {
|
||||
const res = await axios.get(`${ontimeURL}/sheet-state`);
|
||||
export const getSheetState = async ({ queryKey }): Promise<SheetState> => {
|
||||
const [_key, id, worksheet] = queryKey;
|
||||
console.log(queryKey);
|
||||
|
||||
const res = await axios.post(`${ontimeURL}/sheet-state`, {
|
||||
id: '',
|
||||
worksheet: '',
|
||||
});
|
||||
console.log(res.data);
|
||||
return res.data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { queryRefetchIntervalSlow } from '../../ontimeConfig';
|
||||
import { SHEET } from '../api/apiConstants';
|
||||
import { getSheetSettings } from '../api/ontimeApi';
|
||||
|
||||
const sheetPlaceholder = { worksheet: null, id: null };
|
||||
|
||||
export default function useSheet() {
|
||||
const { data, status, isFetching, isError, refetch } = useQuery({
|
||||
queryKey: SHEET,
|
||||
queryFn: getSheetSettings,
|
||||
placeholderData: sheetPlaceholder,
|
||||
retry: 5,
|
||||
retryDelay: (attempt) => attempt * 2500,
|
||||
refetchInterval: queryRefetchIntervalSlow,
|
||||
networkMode: 'always',
|
||||
});
|
||||
|
||||
return { data, status, isFetching, isError, refetch };
|
||||
}
|
||||
@@ -3,9 +3,9 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import { SHEET_STATE } from '../api/apiConstants';
|
||||
import { getSheetState } from '../api/ontimeApi';
|
||||
|
||||
export default function useSheetState() {
|
||||
export default function useSheetState(id, worksheet) {
|
||||
const { data, status, isFetching, isError, refetch } = useQuery({
|
||||
queryKey: SHEET_STATE,
|
||||
queryKey: [SHEET_STATE, { id, worksheet }],
|
||||
queryFn: getSheetState,
|
||||
placeholderData: null,
|
||||
enabled: false,
|
||||
|
||||
Reference in New Issue
Block a user