Fix build.

This commit is contained in:
Sam Rose 2024-02-15 15:52:06 +00:00
parent e4b0330866
commit b4669b32f0
No known key found for this signature in database
1 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import fetch from "node-fetch" import fetch from "node-fetch"
import env from "../../environment" import env from "../../environment"
import { checkSlashesInUrl } from "../../utilities" import { checkSlashesInUrl } from "../../utilities"
import { request } from "../../utilities/workerRequests" import { createRequest } from "../../utilities/workerRequests"
import { clearLock as redisClearLock } from "../../utilities/redis" import { clearLock as redisClearLock } from "../../utilities/redis"
import { DocumentType } from "../../db/utils" import { DocumentType } from "../../db/utils"
import { import {
@ -13,14 +13,19 @@ import {
} from "@budibase/backend-core" } from "@budibase/backend-core"
import { App } from "@budibase/types" import { App } from "@budibase/types"
async function redirect(ctx: any, method: string, path: string = "global") { async function redirect(
ctx: any,
method: "GET" | "POST" | "DELETE",
path: string = "global"
) {
const { devPath } = ctx.params const { devPath } = ctx.params
const queryString = ctx.originalUrl.split("?")[1] || "" const queryString = ctx.originalUrl.split("?")[1] || ""
const response = await fetch( const response = await fetch(
checkSlashesInUrl( checkSlashesInUrl(
`${env.WORKER_URL}/api/${path}/${devPath}?${queryString}` `${env.WORKER_URL}/api/${path}/${devPath}?${queryString}`
), ),
request(ctx, { createRequest({
ctx,
method, method,
body: ctx.request.body, body: ctx.request.body,
}) })