From fb8c649baee57574c9df283385a0368a382e6484 Mon Sep 17 00:00:00 2001 From: Andreas Dinauer Date: Sun, 15 Mar 2026 12:43:03 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Simplify=20Base=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/auth/Account.ts | 9 +---- app/auth/Session.ts | 11 +----- app/components/artifact/Artifact.ts | 2 +- app/utils/Api.ts | 52 +++++++---------------------- 4 files changed, 15 insertions(+), 59 deletions(-) diff --git a/app/auth/Account.ts b/app/auth/Account.ts index 984692d..06d24a1 100644 --- a/app/auth/Account.ts +++ b/app/auth/Account.ts @@ -1,10 +1,7 @@ import axios from "axios"; -import {Api} from "~/utils/Api"; export class Account { - static baseURL: "http://localhost:8089/api/iam-backend/realms/key/accounts"; - firstname?: string; lastname?: string; username?: string; @@ -20,11 +17,7 @@ export class Account static create(user: AccountCreation, onSuccess: () => void) { - AuthApi.create().post('/accounts', user) - .then(() => - { - onSuccess(); - }); + } } diff --git a/app/auth/Session.ts b/app/auth/Session.ts index 72b6a4f..5bf2d85 100644 --- a/app/auth/Session.ts +++ b/app/auth/Session.ts @@ -1,5 +1,4 @@ import {type AxiosResponse} from "axios"; -import {Api} from "~/utils/Api"; import type {Account} from "~/auth/Account"; export class Session @@ -16,15 +15,7 @@ export class Session static create(sessionCreation: SessionCreation, onSuccess: (token: string) => void, onError: () => void) { - AuthApi.create().post("/sessions/" + useRuntimeConfig().public.clientId, sessionCreation) - .then((response: AxiosResponse) => - { - onSuccess(response.data); - }) - .catch(() => - { - onError(); - }); + } } diff --git a/app/components/artifact/Artifact.ts b/app/components/artifact/Artifact.ts index 88c4ad8..44e4bed 100644 --- a/app/components/artifact/Artifact.ts +++ b/app/components/artifact/Artifact.ts @@ -1,4 +1,4 @@ -import {Api, MavenApi} from "~/utils/Api"; +import {MavenApi} from "~/utils/Api"; export class Artifact { diff --git a/app/utils/Api.ts b/app/utils/Api.ts index a5c63c2..a8ec0cc 100644 --- a/app/utils/Api.ts +++ b/app/utils/Api.ts @@ -1,50 +1,22 @@ import axios, {type AxiosInstance} from "axios"; -export abstract class Api +export class MavenApi { - public baseURL: string; - - protected constructor(baseURL: string) + static create() { - this.baseURL = baseURL; - } - - build() - { - const instance: AxiosInstance = axios.create({ - baseURL: this.baseURL - }); - instance.interceptors.request.use((config) => - { - config.withCredentials = true; - return config; - }) - return instance; + return build("/proxy/api"); } } -export class AuthApi extends Api +function build(baseURL: string) { - constructor() + const instance: AxiosInstance = axios.create({ + baseURL: baseURL + }); + instance.interceptors.request.use((config) => { - super("http://localhost:8089/api/iam-backend"); - } - - static create() - { - return new AuthApi().build(); - } -} - -export class MavenApi extends Api -{ - constructor() - { - super("http://localhost:8080"); - } - - static create() - { - return new MavenApi().build(); - } + config.withCredentials = true; + return config; + }) + return instance; } \ No newline at end of file