Live runs refreshing
This commit is contained in:
@@ -11,6 +11,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Problem } from "@/modules/problems/types";
|
||||
import { Clock, Zap, Users, Code } from "lucide-react";
|
||||
import axios from "axios";
|
||||
|
||||
const ProblemCard = ({
|
||||
problem,
|
||||
@@ -100,7 +101,7 @@ const ProblemCard = ({
|
||||
<Button
|
||||
size="icon"
|
||||
onClick={async () => {
|
||||
await fetch(`http://127.0.0.1:63780/start-run/${problem.id}`);
|
||||
await axios.get(`http://127.0.0.1:63780/start-run/${problem.id}`);
|
||||
window.open("vscode://", "_blank");
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -9,12 +9,12 @@ import {
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import LiveRunRow from "./components/LiveRunRow";
|
||||
import useAction from "@/hook/use-action";
|
||||
import useAction, { useActionInterval } from "@/hook/use-action";
|
||||
import { getLiveRuns } from "@/modules/live-run/actions";
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
|
||||
export default function LiveRuns() {
|
||||
const [liveRuns] = useAction(getLiveRuns);
|
||||
const [liveRuns] = useActionInterval(getLiveRuns, 1500);
|
||||
|
||||
// Sort top runners (status === 'pb') to the top
|
||||
const sortedRuns = [...(liveRuns || [])];
|
||||
|
||||
Reference in New Issue
Block a user