From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 11:42:57 +0000 (-0400) Subject: Fix grave `ReferenceError: fetch is not defined` error (#1460) X-Git-Url: http://these/git/ui/assets/static/%7Biframely.thumbnail_url%7D?a=commitdiff_plain;h=9fc3da0264cb7b7acc9ead19791bedb0dc567964;p=lemmy-ui.git Fix grave `ReferenceError: fetch is not defined` error (#1460) * use cross-fetch * remove from utils usage --- diff --git a/src/server/handlers/catch-all-handler.tsx b/src/server/handlers/catch-all-handler.tsx index b9ff13b..efadee4 100644 --- a/src/server/handlers/catch-all-handler.tsx +++ b/src/server/handlers/catch-all-handler.tsx @@ -1,5 +1,6 @@ import { initializeSite, isAuthPath } from "@utils/app"; import { ErrorPageData } from "@utils/types"; +import fetch from "cross-fetch"; import type { Request, Response } from "express"; import { StaticRouter, matchPath } from "inferno-router"; import { renderToString } from "inferno-server"; diff --git a/src/server/handlers/manifest-handler.ts b/src/server/handlers/manifest-handler.ts index 6858cff..b9a1108 100644 --- a/src/server/handlers/manifest-handler.ts +++ b/src/server/handlers/manifest-handler.ts @@ -1,3 +1,4 @@ +import fetch from "cross-fetch"; import type { Request, Response } from "express"; import { LemmyHttp } from "lemmy-js-client"; import { getHttpBaseExternal, getHttpBaseInternal } from "../../shared/env"; diff --git a/src/server/utils/fetch-icon-png.ts b/src/server/utils/fetch-icon-png.ts index 12b09e7..75497a2 100644 --- a/src/server/utils/fetch-icon-png.ts +++ b/src/server/utils/fetch-icon-png.ts @@ -1,3 +1,5 @@ +import fetch from "cross-fetch"; + export async function fetchIconPng(iconUrl: string) { return await fetch(iconUrl) .then(res => res.blob())