From 5e2657d742ddc0e3cf86d808d6e3266a6dd7778d Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Fri, 8 Mar 2024 10:14:54 +0300 Subject: [PATCH] fix: prompt input --- src/components/PromptInput/index.tsx | 2 +- src/hooks/useJsonQuery.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PromptInput/index.tsx b/src/components/PromptInput/index.tsx index 821835f9023..ecb9de8e1d6 100644 --- a/src/components/PromptInput/index.tsx +++ b/src/components/PromptInput/index.tsx @@ -82,7 +82,7 @@ export const PromptInput = () => { if (match && match[1]) { const extractedString = match[1]; - updateJson(extractedString); + await updateJson(extractedString); toast.success(`${data.credits} credits left for today.`); } else { throw Error("An error occured while parsing result."); diff --git a/src/hooks/useJsonQuery.ts b/src/hooks/useJsonQuery.ts index fb811b60aef..aef88dabd98 100644 --- a/src/hooks/useJsonQuery.ts +++ b/src/hooks/useJsonQuery.ts @@ -14,7 +14,7 @@ const useJsonQuery = () => { const updateJson = async (query: string, cb?: () => void) => { try { const jq = await import("jq-web"); - const res = jq.json(JSON.parse(getJson()), query); + const res = await jq.promised.json(JSON.parse(getJson()), query); setContents({ contents: JSON.stringify(res, null, 2) }); cb?.();