diff --git a/.env b/.env index 2f76afc..fb678cb 100644 --- a/.env +++ b/.env @@ -22,3 +22,6 @@ VITE_INSTANCES_RESOURCE_NAME=v1alpha1 VITE_BFF_URL= VITE_NODE_TERMINAL_DEFAULT_PROFILE=baseline + +VITE_LOGIN_URL=/oauth/token +VITE_LOGOUT_URL=/oauth/logout diff --git a/.env.options.dist b/.env.options.dist index 30d0091..6b0e1c5 100644 --- a/.env.options.dist +++ b/.env.options.dist @@ -24,3 +24,6 @@ INSTANCES_RESOURCE_NAME= BFF_URL= NODE_TERMINAL_DEFAULT_PROFILE= + +VITE_LOGIN_URL= +VITE_LOGOUT_URL= diff --git a/package-lock.json b/package-lock.json index 7d4a58e..ea17640 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "@ant-design/icons": "5.6.0", "@monaco-editor/react": "4.6.0", "@originjs/vite-plugin-federation": "1.3.6", - "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.78", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.79", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", @@ -2802,9 +2802,9 @@ } }, "node_modules/@prorobotech/openapi-k8s-toolkit": { - "version": "0.0.1-alpha.78", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.78.tgz", - "integrity": "sha512-Z5sntLIfIwyMTpGIRmra8hbFETCb+Q1if9VO/MO+FBzfLVxbAWGePhkNU/X934ZG7JfydGBWjLtRgfhDha3XBw==", + "version": "0.0.1-alpha.79", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.79.tgz", + "integrity": "sha512-ErZEZOiplg4OrvR4PfkwqoGS1YQ7Ux4x8XngTTJbiKaz6PFVEUns7YwG3+REFnn2EVw2h2f5QX8FKUFeL073AA==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 0205734..5dd6051 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@ant-design/icons": "5.6.0", "@monaco-editor/react": "4.6.0", "@originjs/vite-plugin-federation": "1.3.6", - "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.78", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.79", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", diff --git a/server/index.ts b/server/index.ts index 0f334e3..bd6d6c7 100644 --- a/server/index.ts +++ b/server/index.ts @@ -57,6 +57,9 @@ const BFF_URL = process.env.LOCAL === 'true' ? options?.BFF_URL : process.env.BF const NODE_TERMINAL_DEFAULT_PROFILE = process.env.LOCAL === 'true' ? options?.NODE_TERMINAL_DEFAULT_PROFILE : process.env.NODE_TERMINAL_DEFAULT_PROFILE +const LOGIN_URL = process.env.LOCAL === 'true' ? options?.LOGIN_URL : process.env.LOGIN_URL +const LOGOUT_URL = process.env.LOCAL === 'true' ? options?.LOGOUT_URL : process.env.LOGOUT_URL + const healthcheck = require('express-healthcheck') const promBundle = require('express-prom-bundle') @@ -176,7 +179,9 @@ app.get(`${basePrefix ? basePrefix : ''}/env.js`, (_, res) => { INSTANCES_API_GROUP: ${JSON.stringify(INSTANCES_API_GROUP) || '"check envs"'}, INSTANCES_VERSION: ${JSON.stringify(INSTANCES_VERSION) || '"check envs"'}, INSTANCES_RESOURCE_NAME: ${JSON.stringify(INSTANCES_RESOURCE_NAME) || '"check envs"'}, - NODE_TERMINAL_DEFAULT_PROFILE: ${JSON.stringify(NODE_TERMINAL_DEFAULT_PROFILE) || '"general"'} + NODE_TERMINAL_DEFAULT_PROFILE: ${JSON.stringify(NODE_TERMINAL_DEFAULT_PROFILE) || '"general"'}, + LOGIN_URL: ${JSON.stringify(LOGIN_URL) || '"check envs"'}, + LOGOUT_URL: ${JSON.stringify(LOGOUT_URL) || '"check envs"'} } `, ) diff --git a/src/api/auth.ts b/src/api/auth.ts index 6ee752d..d149cc5 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -1,12 +1,13 @@ import axios, { AxiosResponse } from 'axios' import { TAuthResponse } from 'localTypes/auth' +import { LOGIN_URL, LOGOUT_URL } from 'constants/customizationApiGroupAndVersion' import { handleError } from './handleResponse' export const login = async (): Promise => { let response: AxiosResponse | undefined try { - response = await axios.get('/oauth/token', { withCredentials: true }) + response = await axios.get(LOGIN_URL, { withCredentials: true }) } catch (error) { handleError(error) } @@ -18,7 +19,7 @@ export const logout = async (): Promise => { let response: AxiosResponse | undefined try { - response = await axios.get('/oauth/logout', { withCredentials: true }) + response = await axios.get(LOGOUT_URL, { withCredentials: true }) } catch (error) { handleError(error) } finally { diff --git a/src/constants/customizationApiGroupAndVersion.ts b/src/constants/customizationApiGroupAndVersion.ts index 74f8414..d054e0e 100644 --- a/src/constants/customizationApiGroupAndVersion.ts +++ b/src/constants/customizationApiGroupAndVersion.ts @@ -28,3 +28,6 @@ export const BASE_INSTANCES_RESOURCE_NAME = export const NODE_TERMINAL_DEFAULT_PROFILE = window._env_.NODE_TERMINAL_DEFAULT_PROFILE || import.meta.env.VITE_NODE_TERMINAL_DEFAULT_PROFILE + +export const LOGIN_URL = window._env_.LOGIN_URL || import.meta.env.VITE_LOGIN_URL +export const LOGOUT_URL = window._env_.LOGOUT_URL || import.meta.env.VITE_LOGOUT_URL