All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 2m27s
23 lines
508 B
TypeScript
23 lines
508 B
TypeScript
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
|
import axios from "axios";
|
|
|
|
export function servers() {
|
|
return queryOptions({
|
|
queryKey: ["servers"],
|
|
queryFn: () => fetch(),
|
|
staleTime: 5000,
|
|
refetchOnWindowFocus: true,
|
|
placeholderData: keepPreviousData,
|
|
});
|
|
}
|
|
|
|
const fetch = async () => {
|
|
if (window.location.hostname === "localhost") {
|
|
await new Promise((res) => setTimeout(res, 1500));
|
|
}
|
|
|
|
const { data } = await axios.get("/lst/api/servers");
|
|
|
|
return data.data;
|
|
};
|