refactor(ocp): change the way logs are brought in and other changes to clean the code up
This commit is contained in:
19
frontend/src/utils/querys/production/getOcmeInfo.tsx
Normal file
19
frontend/src/utils/querys/production/getOcmeInfo.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { queryOptions } from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
|
||||
export function getOcmeInfo() {
|
||||
return queryOptions({
|
||||
queryKey: ["ocmeInfo"],
|
||||
queryFn: () => fetchSettings(),
|
||||
staleTime: 1000,
|
||||
refetchInterval: 2 * 2000,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
}
|
||||
|
||||
const fetchSettings = async () => {
|
||||
const { data } = await axios.get(`/ocme/api/v1/getInfo`);
|
||||
// if we are not localhost ignore the devDir setting.
|
||||
//const url: string = window.location.host.split(":")[0];
|
||||
return data.data ?? [];
|
||||
};
|
||||
@@ -6,7 +6,7 @@ export function getlabels(hours: string) {
|
||||
queryKey: ["labels"],
|
||||
queryFn: () => fetchSettings(hours),
|
||||
|
||||
staleTime: 1000,
|
||||
//staleTime: 1000,
|
||||
refetchInterval: 2 * 2000,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ export function getOcpLogs(hours: string) {
|
||||
|
||||
const fetchSettings = async (hours: string) => {
|
||||
const { data } = await axios.get(
|
||||
`/api/logger/logs?service=ocp&service=rfid&level=error&level=warn&hours=${hours}`
|
||||
`/api/logger/logs?service=ocp&service=rfid&service=dyco&level=error&level=warn&hours=${hours}`
|
||||
);
|
||||
// if we are not localhost ignore the devDir setting.
|
||||
//const url: string = window.location.host.split(":")[0];
|
||||
|
||||
Reference in New Issue
Block a user