Skip to content

Commit

Permalink
typos
Browse files Browse the repository at this point in the history
  • Loading branch information
charlypoly committed Mar 5, 2024
1 parent 70e4924 commit c032204
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/next/asNextRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface Options<
proxy?: (request: NextRequest) => Promise<Parameters<F>>;
}

const ResponseJSON = Responseon;
const ResponseJSON = Response.json;

export function asNextRoute<F extends (...args: any) => Promise<any>>(
deferFn: DeferredFunction<F>,
Expand Down Expand Up @@ -64,7 +64,7 @@ export function asNextRoute<F extends (...args: any) => Promise<any>>(
PostHandler: async (request: NextRequest) => {
const args: any = options?.proxy
? await options.proxy(request)
: await requeston();
: await request.json();
if (Array.isArray(args)) {
// @ts-expect-error Charly: need to be refined
const execution = await deferFn(...args);
Expand Down
4 changes: 2 additions & 2 deletions src/next/useDeferRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const useDeferRoute = <
const res = await fetch(`${routePath}?id=${executionId}`, {
method: "GET",
});
const data = (await reson()) as any;
const data = (await res.json()) as any;
setStatus(data.state);
if (["succeed", "failed"].includes(data.state) && intervalRef.current) {
clearInterval(intervalRef.current);
Expand All @@ -67,7 +67,7 @@ export const useDeferRoute = <
"Content-type": "application/json",
},
});
const data = await resulton();
const data = await result.json();
intervalRef.current = setInterval(
pollExecution(data.id),
Math.max(500, refreshInterval),
Expand Down

0 comments on commit c032204

Please sign in to comment.