mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 10:33:01 +00:00
full comments system
This commit is contained in:
19
packages/frontend/src/lib/server/issue-comment/byIssue.ts
Normal file
19
packages/frontend/src/lib/server/issue-comment/byIssue.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { IssueCommentResponse } from "@sprint/shared";
|
||||
import { getServerURL } from "@/lib/utils";
|
||||
import { getErrorMessage } from "..";
|
||||
|
||||
export async function byIssue(issueId: number): Promise<IssueCommentResponse[]> {
|
||||
const url = new URL(`${getServerURL()}/issue-comments/by-issue`);
|
||||
url.searchParams.set("issueId", `${issueId}`);
|
||||
|
||||
const res = await fetch(url.toString(), {
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const message = await getErrorMessage(res, `failed to get issue comments (${res.status})`);
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
return res.json();
|
||||
}
|
||||
Reference in New Issue
Block a user