21 lines
584 B
TypeScript
21 lines
584 B
TypeScript
import { queryOptions } from "@tanstack/react-query";
|
|
import axios from "axios";
|
|
|
|
export function getLanes() {
|
|
return queryOptions({
|
|
queryKey: ["getLanes"],
|
|
queryFn: () => fetch(),
|
|
//enabled:
|
|
staleTime: 1000,
|
|
refetchInterval: 60 * 1000,
|
|
refetchOnWindowFocus: true,
|
|
});
|
|
}
|
|
|
|
const fetch = async () => {
|
|
const { data } = await axios.get(`/api/logistics/getactivelanes`);
|
|
// // if we are not localhost ignore the devDir setting.
|
|
// //const url: string = window.location.host.split(":")[0];
|
|
return data.data ?? [];
|
|
};
|