@@ -10,14 +10,14 @@ import {
1010import * as fs from 'fs' ;
1111import { JSDOM } from 'jsdom' ;
1212import * as path from 'path' ;
13- import fetch from 'node-fetch' ;
1413
1514import { AdminGuard } from '../admin/admin.guard' ;
1615
1716import { ViewSSRCacheService } from './view.ssr.cache.service' ;
1817
1918import { OptionalPipe } from '../helper/OptionalPipe' ;
2019import { StringPipe } from '../helper/StringPipe' ;
20+ import { ViewSSRFetchService } from './view.ssr.fetch.service' ;
2121
2222@Controller ( )
2323export class ViewSSRController {
@@ -29,7 +29,10 @@ export class ViewSSRController {
2929 private readonly attachments : string [ ] ;
3030 private readonly timeout : number ;
3131
32- constructor ( private cache : ViewSSRCacheService ) {
32+ constructor (
33+ private cache : ViewSSRCacheService ,
34+ private fetch : ViewSSRFetchService
35+ ) {
3336 const frontendDir = process . env . SSR_FRONTEND_DIR || process . cwd ( ) ;
3437 this . frontendEvent = process . env . SSR_FRONTEND_EVENT || 'app-loaded' ;
3538 this . indexHTML = fs . readFileSync (
@@ -87,7 +90,8 @@ export class ViewSSRController {
8790 // Poly-fill some window functions here.
8891 // eslint-disable-next-line @typescript-eslint/no-empty-function
8992 dom . window . scrollTo = ( ) => { } ;
90- dom . window . fetch = fetch as unknown as typeof dom . window . fetch ;
93+ dom . window . fetch = this . fetch
94+ . fetch as unknown as typeof dom . window . fetch ;
9195
9296 const timeout = setTimeout ( ( ) => {
9397 this . logger . warn (
0 commit comments