mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-02-04 01:32:54 +08:00
fix: prompt input
This commit is contained in:
parent
0571924dc1
commit
5e2657d742
@ -82,7 +82,7 @@ export const PromptInput = () => {
|
|||||||
|
|
||||||
if (match && match[1]) {
|
if (match && match[1]) {
|
||||||
const extractedString = match[1];
|
const extractedString = match[1];
|
||||||
updateJson(extractedString);
|
await updateJson(extractedString);
|
||||||
toast.success(`${data.credits} credits left for today.`);
|
toast.success(`${data.credits} credits left for today.`);
|
||||||
} else {
|
} else {
|
||||||
throw Error("An error occured while parsing result.");
|
throw Error("An error occured while parsing result.");
|
||||||
|
@ -14,7 +14,7 @@ const useJsonQuery = () => {
|
|||||||
const updateJson = async (query: string, cb?: () => void) => {
|
const updateJson = async (query: string, cb?: () => void) => {
|
||||||
try {
|
try {
|
||||||
const jq = await import("jq-web");
|
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) });
|
setContents({ contents: JSON.stringify(res, null, 2) });
|
||||||
cb?.();
|
cb?.();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user