Skip to content

Commit

Permalink
chore: format and lint the code
Browse files Browse the repository at this point in the history
  • Loading branch information
a0m0rajab committed Nov 16, 2023
1 parent 1a1d77c commit b2b11dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/repo-query/pages/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Chat = ({ ownerName, repoName }: { ownerName: string, repoName: str

const processChunk = (chunk: string) => {
const chunkLines = chunk.split("\n");
const indexOfEvent = chunkLines.findIndex((e) => e.includes("event: "))
const indexOfEvent = chunkLines.findIndex(e => e.includes("event: "));
const [eventLine, dataLine] = [chunkLines[indexOfEvent], chunkLines[indexOfEvent + 1]];

const event = eventLine.split(": ")[1];
Expand All @@ -28,6 +28,7 @@ export const Chat = ({ ownerName, repoName }: { ownerName: string, repoName: str
data = JSON.parse(dataLine.split(": ")[1]);
} catch (e) {
console.error("The recieved data line", dataLine);

// remove quotes from string
data = dataLine.split("data: ")[1].substring(1, dataLine.split("data: ")[1].length - 2);
}
Expand Down

0 comments on commit b2b11dc

Please sign in to comment.