From 9ef48c9e7d4552e10b031a7e5649a0d1a2d60421 Mon Sep 17 00:00:00 2001 From: Anchel123 <110421452+Anchel123@users.noreply.github.com> Date: Sun, 21 Apr 2024 11:04:07 +0300 Subject: [PATCH] add fetch request every create graph to update the DB with the new graph --- app/graph/mainQuery.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/graph/mainQuery.tsx b/app/graph/mainQuery.tsx index 1f337b9..d742fc0 100644 --- a/app/graph/mainQuery.tsx +++ b/app/graph/mainQuery.tsx @@ -119,6 +119,10 @@ export default function MainQuery({ onSubmit, onDelete, className = "" }: { } const addOption = (newGraph: string) => { + const q = "return 1" + fetch(`api/graph?graph=${encodeURIComponent(newGraph)}&query=${encodeURIComponent(q)}`, { + method: "GET", + }) setGraphs((prevGraphs: string[]) => [...prevGraphs, newGraph]); setGraphName(newGraph) }