fixed bug with env login

This commit is contained in:
GotthardG 2024-12-11 12:03:33 +01:00
parent c3b24c213a
commit 9e88fb3270
3 changed files with 12 additions and 4 deletions

View File

@ -82,5 +82,5 @@ if __name__ == "__main__":
key_path = "ssl/mx-aare-test.psi.ch.key"
# Run the application with appropriate SSL setup
uvicorn.run(app, host="0.0.0.0", port=8000, log_level="debug",
uvicorn.run(app, port=8000, log_level="debug",
ssl_keyfile=key_path, ssl_certfile=cert_path)

View File

@ -1,7 +1,7 @@
// LoginView.tsx
import React, { useState } from 'react';
import React, {useEffect, useState} from 'react';
import { useNavigate } from 'react-router-dom';
import { AuthService } from '../../openapi'; // Adjust import path
import {AuthService, OpenAPI} from '../../openapi'; // Adjust import path
const containerStyle = {
display: 'flex',
@ -56,6 +56,14 @@ const LoginView: React.FC = () => {
const [error, setError] = useState('');
const navigate = useNavigate();
useEffect(() => {
const isTestEnv = import.meta.env.MODE === 'test';
OpenAPI.BASE = isTestEnv
? import.meta.env.VITE_OPENAPI_BASE_TEST
: import.meta.env.VITE_OPENAPI_BASE_DEV;
;
}, []);
const handleLogin = async (e: React.FormEvent) => {
e.preventDefault();

View File

@ -14,7 +14,7 @@ export default defineConfig(({ mode }) => {
key: env.VITE_SSL_KEY_PATH,
cert: env.VITE_SSL_CERT_PATH,
},
host: true,
host: '0.0.0.0',
port: 5173,
},
};