feat(dev): preload dev account from .env (#803)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { AppState } from '@/ui_models/app_state';
|
||||
import { isDev } from '@/utils';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { FunctionComponent } from 'preact';
|
||||
import { useState } from 'preact/hooks';
|
||||
@@ -19,6 +20,12 @@ export const AdvancedOptions: FunctionComponent<Props> = observer(
|
||||
appState.accountMenu;
|
||||
const [showAdvanced, setShowAdvanced] = useState(false);
|
||||
|
||||
if (isDev && window._devAccountServer) {
|
||||
setEnableServerOption(true);
|
||||
setServer(window._devAccountServer);
|
||||
application.setCustomHost(window._devAccountServer);
|
||||
}
|
||||
|
||||
const handleServerOptionChange = (e: Event) => {
|
||||
if (e.target instanceof HTMLInputElement) {
|
||||
setEnableServerOption(e.target.checked);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { AppState } from '@/ui_models/app_state';
|
||||
import { isDev } from '@/utils';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { FunctionComponent } from 'preact';
|
||||
import { useEffect, useRef, useState } from 'preact/hooks';
|
||||
@@ -32,6 +33,11 @@ export const SignInPane: FunctionComponent<Props> = observer(
|
||||
const emailInputRef = useRef<HTMLInputElement>(null);
|
||||
const passwordInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
if (isDev && window._devAccountEmail) {
|
||||
setEmail(window._devAccountEmail);
|
||||
setPassword(window._devAccountPassword as string);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (emailInputRef?.current) {
|
||||
emailInputRef.current?.focus();
|
||||
|
||||
Reference in New Issue
Block a user