Skip to content

Commit

Permalink
Avoid cast
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Apr 17, 2024
1 parent c05fea0 commit e094089
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/routes/(pages)/home/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { gfmHeadingId } from "marked-gfm-heading-id";
import DOMPurify from "isomorphic-dompurify";

import { BASE_API_URL } from "@/config/config.js";
import { isErrorCode } from "@/lib/utils/api";

marked.use(gfmHeadingId());

Expand All @@ -15,8 +16,8 @@ const endpoint = new URL("home/", ROOT);
export async function load({ fetch }) {
const resp = await fetch(endpoint, { credentials: "include" });

if (!resp.ok) {
error(resp.status as NumericRange<400, 599>, resp.statusText);
if (isErrorCode(resp.status)) {
error(resp.status, resp.statusText);
}

const page = await resp.json();
Expand Down

0 comments on commit e094089

Please sign in to comment.