Skip to content

Commit

Permalink
log build result
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Aug 16, 2024
1 parent 4db610a commit b720723
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/api/build/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getBuildServerBaseUrl, getSolangBuildServerBaseUrl } from "@/lib/env";
import { fileContentToZip } from "@/lib/file-content-to-zip";
import { type NextRequest } from "next/server";
import { v4 as uuidv4 } from "uuid";
import { strToU8 } from "fflate";
import { strFromU8, strToU8 } from "fflate";

export async function POST(request: NextRequest) {
const { files } = (await request.json()) as { files: FileContent[] };
Expand Down Expand Up @@ -61,7 +61,11 @@ export async function POST(request: NextRequest) {
return Response.json({ error: message }, { status: response.status });
}

return Response.json({ dll: (await response.json()).compileResult });
const { compileResult } = (await response.json()) || {};

const str = strFromU8(Buffer.from(compileResult, "base64"));

return Response.json({ dll: str });
} else {
return Response.json({ error: "Invalid input files" }, { status: 400 });
}
Expand Down
1 change: 1 addition & 0 deletions components/workspace/use-cli-commands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export function useCliCommands() {
body: JSON.stringify({ files }),
});
const { dll, error } = await res.json();
console.log(dll, "-- build result");
if (typeof dll === "string" && !error) {
await db.workspaces.update(id, { dll });
terminalContext.setBufferedContent(
Expand Down

0 comments on commit b720723

Please sign in to comment.