fix
This commit is contained in:
parent
d94c1c3089
commit
14805dbfc4
@ -1,11 +1,11 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { AppRoutes } from './app/Routes';
|
import { AppRoutes } from './app/Routes';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import { isTestMode } from './conf/config';
|
import { Config } from './conf/config';
|
||||||
|
|
||||||
const BaseTag = () => {
|
const BaseTag = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isTestMode) {
|
if (Config.DEBUG) {
|
||||||
const baseTag = document.createElement('base');
|
const baseTag = document.createElement('base');
|
||||||
baseTag.href = process.env.REACT_APP_BASE_URL || window.location.origin;
|
baseTag.href = process.env.REACT_APP_BASE_URL || window.location.origin;
|
||||||
document.head.prepend(baseTag);
|
document.head.prepend(baseTag);
|
||||||
|
|||||||
@ -20,4 +20,3 @@ export class Config {
|
|||||||
static APP_NAME: string = environment.REACT_APP_APP_NAME ?? '';
|
static APP_NAME: string = environment.REACT_APP_APP_NAME ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isTestMode = environment.REACT_APP_BASE_PATH !== environment.REACT_APP_ROOT_PATH;
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useAuth } from '../app/context/AuthProvider';
|
import { useAuth } from '../app/context/AuthProvider';
|
||||||
import { isTestMode } from '../conf/config';
|
import { Config } from '../conf/config';
|
||||||
|
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
const [username, setUsername] = useState('admin');
|
const [username, setUsername] = useState('admin');
|
||||||
@ -11,11 +11,11 @@ export default function LoginPage() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isTestMode && isAuthenticated) {
|
if (Config.DEBUG && isAuthenticated) {
|
||||||
navigate('/', { replace: true });
|
navigate('/', { replace: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, [isTestMode, isAuthenticated, navigate]);
|
}, [isAuthenticated, navigate]);
|
||||||
|
|
||||||
const onSubmit = async (e) => {
|
const onSubmit = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user