mirror of
https://dev.azure.com/tstanciu94/PhantomMind/_git/Bitip
synced 2025-10-13 01:52:19 +03:00
refactor: update runtime configuration keys to uppercase and add type declarations
This commit is contained in:
parent
798025a971
commit
91f667e4c3
@ -32,7 +32,7 @@ export function generateRuntimeConfig(
|
||||
|
||||
// Generate env.js content
|
||||
const envConfig = {
|
||||
basePath: basePath || '/',
|
||||
BASE_PATH: basePath || '/',
|
||||
FRONTEND_API_KEY: config.apiKeys.frontend,
|
||||
};
|
||||
|
||||
|
@ -2,5 +2,6 @@
|
||||
// DO NOT EDIT - This file is automatically generated
|
||||
// eslint-disable-next-line no-undef
|
||||
window.env = {
|
||||
"basePath": "/"
|
||||
"BASE_PATH": "/",
|
||||
"FRONTEND_API_KEY": "frontend-dev-key"
|
||||
};
|
||||
|
@ -3,17 +3,7 @@ import ReactDOM from 'react-dom/client';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import App from './App.tsx';
|
||||
|
||||
// Runtime config loaded from env.js (generated by backend at startup)
|
||||
declare global {
|
||||
interface Window {
|
||||
env?: {
|
||||
basePath?: string;
|
||||
FRONTEND_API_KEY: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const basename = window.env?.basePath || '/';
|
||||
const basename = window.env.BASE_PATH || '/';
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
|
20
src/frontend/src/types/globals.d.ts
vendored
Normal file
20
src/frontend/src/types/globals.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Global type declarations for the Bitip frontend application
|
||||
* This file contains ambient declarations for global objects and runtime configuration
|
||||
*/
|
||||
|
||||
/**
|
||||
* Runtime configuration loaded from env.js
|
||||
* Generated by backend at startup and injected into window object
|
||||
*/
|
||||
declare global {
|
||||
interface Window {
|
||||
env: {
|
||||
BASE_PATH: string;
|
||||
FRONTEND_API_KEY: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// This export makes this file a module, which is required for global augmentation
|
||||
export {};
|
Loading…
x
Reference in New Issue
Block a user