Fix grave ReferenceError: fetch is not defined error (#1460)

* use cross-fetch

* remove from utils usage
This commit is contained in:
Alec Armbruster 2023-06-22 07:42:57 -04:00 committed by GitHub
parent cda9bd0a79
commit 9fc3da0264
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 0 deletions

View file

@ -1,5 +1,6 @@
import { initializeSite, isAuthPath } from "@utils/app"; import { initializeSite, isAuthPath } from "@utils/app";
import { ErrorPageData } from "@utils/types"; import { ErrorPageData } from "@utils/types";
import fetch from "cross-fetch";
import type { Request, Response } from "express"; import type { Request, Response } from "express";
import { StaticRouter, matchPath } from "inferno-router"; import { StaticRouter, matchPath } from "inferno-router";
import { renderToString } from "inferno-server"; import { renderToString } from "inferno-server";

View file

@ -1,3 +1,4 @@
import fetch from "cross-fetch";
import type { Request, Response } from "express"; import type { Request, Response } from "express";
import { LemmyHttp } from "lemmy-js-client"; import { LemmyHttp } from "lemmy-js-client";
import { getHttpBaseExternal, getHttpBaseInternal } from "../../shared/env"; import { getHttpBaseExternal, getHttpBaseInternal } from "../../shared/env";

View file

@ -1,3 +1,5 @@
import fetch from "cross-fetch";
export async function fetchIconPng(iconUrl: string) { export async function fetchIconPng(iconUrl: string) {
return await fetch(iconUrl) return await fetch(iconUrl)
.then(res => res.blob()) .then(res => res.blob())