diff --git a/src/components/PromptInput/index.tsx b/src/components/PromptInput/index.tsx index 821835f..ecb9de8 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 fb811b6..aef88da 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?.();