diff --git a/src/app/(rucio)/did/list/page.tsx b/src/app/(rucio)/did/list/page.tsx index d4a96b907..fc7543dc7 100644 --- a/src/app/(rucio)/did/list/page.tsx +++ b/src/app/(rucio)/did/list/page.tsx @@ -15,7 +15,7 @@ export default function Page() { } const didQuery = async (query: string, type: DIDType) => { const request: any = { - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-dids`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-dids`), method: 'GET', headers: new Headers({ 'Content-Type': 'application/json', diff --git a/src/app/(rucio)/did/page/[scope]/[name]/page.tsx b/src/app/(rucio)/did/page/[scope]/[name]/page.tsx index 28176fc89..eb07eafa5 100644 --- a/src/app/(rucio)/did/page/[scope]/[name]/page.tsx +++ b/src/app/(rucio)/did/page/[scope]/[name]/page.tsx @@ -30,7 +30,7 @@ export default function Page({ params }: { params: { scope: string, name: string ) const didFileReplicasDOnChange = (scope: string, name: string) => { didFileReplicasComDOM.setRequest({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-file-replicas`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-file-replicas`), method: 'GET', params: { scope: scope, @@ -52,7 +52,7 @@ export default function Page({ params }: { params: { scope: string, name: string useEffect(() => { const setRequests = async () => { await didContentsComDOM.setRequest({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-did-contents`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-did-contents`), method: 'GET', params: { scope: params.scope, @@ -64,7 +64,7 @@ export default function Page({ params }: { params: { scope: string, name: string body: null, } as HTTPRequest) await didParentsComDOM.setRequest({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-did-parents`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-did-parents`), method: 'GET', params: { scope: params.scope, @@ -76,7 +76,7 @@ export default function Page({ params }: { params: { scope: string, name: string body: null, } as HTTPRequest) await didFileReplicasComDOM.setRequest({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-file-replicas`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-file-replicas`), method: 'GET', params: { scope: params.scope, @@ -88,7 +88,7 @@ export default function Page({ params }: { params: { scope: string, name: string body: null, } as HTTPRequest) await didRulesComDOM.setRequest({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-did-rules`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-did-rules`), method: 'GET', params: { scope: params.scope, @@ -100,7 +100,7 @@ export default function Page({ params }: { params: { scope: string, name: string body: null, } as HTTPRequest) await didDatasetReplicasComDOM.setRequest({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-dataset-replicas`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-dataset-replicas`), method: 'GET', params: { scope: params.scope, diff --git a/src/app/(rucio)/did/queries.ts b/src/app/(rucio)/did/queries.ts index d8dfc926f..18954c963 100644 --- a/src/app/(rucio)/did/queries.ts +++ b/src/app/(rucio)/did/queries.ts @@ -1,13 +1,13 @@ import { DIDKeyValuePairsDataViewModel, DIDMetaViewModel } from "@/lib/infrastructure/data/view-model/did"; export async function didMetaQueryBase(scope: string, name: string): Promise { - const url = `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-did-meta?` + new URLSearchParams({scope, name}) + const url = '/api/feature/get-did-meta?' + new URLSearchParams({scope, name}) const res = await fetch(url) return await res.json() } export async function didKeyValuePairsDataQuery(scope: string, name: string): Promise { - const url = `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-did-keyvaluepairs?` + new URLSearchParams({scope, name}) + const url = '/api/feature/get-did-keyvaluepairs?' + new URLSearchParams({scope, name}) const res = await fetch(url) return await res.json() } \ No newline at end of file diff --git a/src/app/(rucio)/queries.ts b/src/app/(rucio)/queries.ts index 3ecca2d80..2e141c09d 100644 --- a/src/app/(rucio)/queries.ts +++ b/src/app/(rucio)/queries.ts @@ -1,23 +1,6 @@ import { SiteHeaderViewModel } from '@/lib/infrastructure/data/view-model/site-header' export async function getSiteHeader(): Promise { - const req: any = { - method: 'GET', - url: new URL( - `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-site-header`, - ), - headers: { - 'Content-Type': 'application/json', - }, - params: {}, - } - - const res = await fetch(req.url, { - method: 'GET', - headers: new Headers({ - 'Content-Type': 'application/json', - } as HeadersInit), - }) - + const res = await fetch('/api/feature/get-site-header') return await res.json() } diff --git a/src/app/(rucio)/rse/list/page.tsx b/src/app/(rucio)/rse/list/page.tsx index 3b09a3ab0..86665d454 100644 --- a/src/app/(rucio)/rse/list/page.tsx +++ b/src/app/(rucio)/rse/list/page.tsx @@ -8,7 +8,7 @@ export default function Page() { const setRSEQuery = async (rseExpression: string) => { await RSESearchComDOM.setRequest({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-rses`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-rses`), method: 'GET', headers: new Headers({ 'Content-Type': 'application/json', diff --git a/src/app/(rucio)/rse/queries.ts b/src/app/(rucio)/rse/queries.ts index f5cf55f65..46177aa0b 100644 --- a/src/app/(rucio)/rse/queries.ts +++ b/src/app/(rucio)/rse/queries.ts @@ -1,19 +1,19 @@ import { RSEAttributeViewModel, RSEProtocolViewModel, RSEViewModel } from "@/lib/infrastructure/data/view-model/rse"; export async function getRSE(rseName: string): Promise { - const url = `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-rse?` + new URLSearchParams({rseName}) + const url = '/api/feature/get-rse?' + new URLSearchParams({rseName}) const res = await fetch(url) return await res.json() } export async function getProtocols(rseName: string): Promise { - const url = `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-rse-protocols?` + new URLSearchParams({rseName}) + const url = '/api/feature/get-rse-protocols?' + new URLSearchParams({rseName}) const res = await fetch(url) return await res.json() } export async function getAttributes(rseName:string): Promise { - const url = `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-rse-attributes?` + new URLSearchParams({rseName}) + const url = '/api/feature/get-rse-attributes?' + new URLSearchParams({rseName}) const res = await fetch(url) return await res.json() } diff --git a/src/app/(rucio)/rucio-app-layout.tsx b/src/app/(rucio)/rucio-app-layout.tsx index 89fee66ca..1067d3101 100644 --- a/src/app/(rucio)/rucio-app-layout.tsx +++ b/src/app/(rucio)/rucio-app-layout.tsx @@ -14,7 +14,7 @@ export const RucioAppLayout = (props: QueryContextLayoutProps) => { homeUrl: "" }) const fetchAccounts = async () => { - await fetch(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-site-header`) + await fetch('/api/feature/get-site-header') .then(res => { if (res.ok) { return res.json() diff --git a/src/app/(rucio)/rule/create/page.tsx b/src/app/(rucio)/rule/create/page.tsx index 560bba0c8..9bd5c64a1 100644 --- a/src/app/(rucio)/rule/create/page.tsx +++ b/src/app/(rucio)/rule/create/page.tsx @@ -22,7 +22,7 @@ export default function CreateRule() { viewModel.status = 'pending' try { - const response = await fetch(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/create-rule`, { + const response = await fetch(`/api/feature/create-rule`, { method: "POST", headers: new Headers({ 'Content-Type': 'application/json' @@ -100,7 +100,7 @@ export default function CreateRule() { const [accountInfo, setAccountInfo] = useState(generateEmptyAccountInfoViewModel()) useEffect(() => { - fetch(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/account-info`) + fetch(`${window.location.protocol}//${window.location.host}/api/feature/account-info`) .then((response) => { if(response.ok) { return response.json() diff --git a/src/app/(rucio)/rule/page/[id]/page.tsx b/src/app/(rucio)/rule/page/[id]/page.tsx index 393b75c73..56f587ac7 100644 --- a/src/app/(rucio)/rule/page/[id]/page.tsx +++ b/src/app/(rucio)/rule/page/[id]/page.tsx @@ -27,7 +27,7 @@ export default function PageRule({ params }: { params: { id: string } }) { useEffect(() => { // TODO get from mock endpoint - fetch(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/mock-get-rule-meta`) + fetch('/api/feature/mock-get-rule-meta') .then(res => { if (res.ok) { return res.json() @@ -46,7 +46,7 @@ export default function PageRule({ params }: { params: { id: string } }) { useEffect(() => { const runQuery = async () => { const request: HTTPRequest = { - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/mock-list-rule-page-lock`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/mock-list-rule-page-lock`), method: "GET", headers: new Headers({ 'Content-Type': 'application/json' diff --git a/src/app/(rucio)/subscription/list/page.tsx b/src/app/(rucio)/subscription/list/page.tsx index 9ef759405..0e4210293 100644 --- a/src/app/(rucio)/subscription/list/page.tsx +++ b/src/app/(rucio)/subscription/list/page.tsx @@ -28,7 +28,7 @@ export default function ListSubscription({ params }: { params: { account: string useEffect(() => { const runQuery = async () => { await ComDOM.start({ - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-subscription-rule-states`), + url: new URL(`${window.location.protocol}//${window.location.host}/api/feature/list-subscription-rule-states`), method: "GET", headers: new Headers({ 'Content-Type': 'application/json' diff --git a/src/app/(rucio)/subscription/page/[account]/[name]/page.tsx b/src/app/(rucio)/subscription/page/[account]/[name]/page.tsx index 7bf35d4ac..35ab2b0bf 100644 --- a/src/app/(rucio)/subscription/page/[account]/[name]/page.tsx +++ b/src/app/(rucio)/subscription/page/[account]/[name]/page.tsx @@ -12,7 +12,7 @@ async function updateSubscription( ) { const req: any = { method: "PUT", - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/mock-update-subscription`), + url: new URL(`/api/feature/mock-update-subscription`), headers: { 'Content-Type': 'application/json', }, @@ -43,7 +43,7 @@ export default function PageSubscription({ params }: { params: { account: string async function subscriptionQuery(account: string, name: string): Promise { const req: any = { method: "GET", - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-subscription`), + url: new URL(`/api/feature/get-subscription`), params: { "account": account, "name": name diff --git a/src/app/moncomdom/page.tsx b/src/app/moncomdom/page.tsx index 8e8e996a1..cb5b68920 100644 --- a/src/app/moncomdom/page.tsx +++ b/src/app/moncomdom/page.tsx @@ -79,7 +79,7 @@ export default function RSETable() {