Small fixes

This commit is contained in:
Reckless_Satoshi 2022-11-07 04:50:43 -08:00
parent 0ce3aff484
commit 7c2f6e1659
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
7 changed files with 19 additions and 6 deletions

View File

@ -132,6 +132,7 @@ const BookPage = ({
setPage('order');
history.push('/order/' + id);
}}
baseUrl={baseUrl}
/>
</Box>
</Dialog>

View File

@ -107,7 +107,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
window.removeEventListener('resize', onResize);
}
};
}, []);
}, [baseUrl]);
useEffect(() => {
let host = '';
@ -316,6 +316,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
setFav={setFav}
windowSize={{ ...windowSize, height: windowSize.height - navbarHeight }}
hasRobot={robot.avatarLoaded}
baseUrl={baseUrl}
/>
</div>
</Slide>

View File

@ -24,6 +24,7 @@ interface MakerPageProps {
hasRobot: boolean;
setCurrentOrder: (state: number) => void;
setPage: (state: Page) => void;
baseUrl: string;
}
const MakerPage = ({
@ -38,6 +39,7 @@ const MakerPage = ({
setCurrentOrder,
setPage,
hasRobot = false,
baseUrl,
}: MakerPageProps): JSX.Element => {
const { t } = useTranslation();
const history = useHistory();
@ -108,6 +110,7 @@ const MakerPage = ({
onReset={() => setShowMatches(false)}
submitButtonLabel={matches.length > 0 && !showMatches ? 'Submit' : 'Create order'}
setPage={setPage}
baseUrl={baseUrl}
/>
</Paper>
</Grid>

View File

@ -29,9 +29,8 @@ import { LimitList, Maker, Favorites, defaultMaker } from '../../models';
import { LocalizationProvider, TimePicker } from '@mui/x-date-pickers';
import DateFnsUtils from '@date-io/date-fns';
import { useHistory } from 'react-router-dom';
import { StoreTokenDialog, NoRobotDialog, ConfirmationDialog } from '../Dialogs';
import { ConfirmationDialog } from '../Dialogs';
import { apiClient } from '../../services/api';
import { systemClient } from '../../services/System';
import { FlagWithProps } from '../Icons';
import AutocompletePayments from './AutocompletePayments';
@ -59,6 +58,7 @@ interface MakerFormProps {
onOrderCreated?: (id: number) => void;
hasRobot?: boolean;
setPage?: (state: Page) => void;
baseUrl: string;
}
const MakerForm = ({
@ -77,6 +77,7 @@ const MakerForm = ({
onOrderCreated = () => null,
hasRobot = true,
setPage = () => null,
baseUrl,
}: MakerFormProps): JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
@ -263,7 +264,7 @@ const MakerForm = ({
escrow_duration: maker.escrowDuration,
bond_size: maker.bondSize,
};
apiClient.post('/api/make/', body).then((data: object) => {
apiClient.post(baseUrl, '/api/make/', body).then((data: object) => {
setBadRequest(data.bad_request);
if (data.id) {
onOrderCreated(data.id);

View File

@ -150,7 +150,10 @@ const SettingsForm = ({
<ToggleButtonGroup
exclusive={true}
value={settings.network}
onChange={(e, network) => setSettings({ ...settings, network })}
onChange={(e, network) => {
setSettings({ ...settings, network });
systemClient.setCookie('settings_network', network);
}}
>
<ToggleButton value='mainnet' color='primary'>
{t('Mainnet')}

View File

@ -37,6 +37,9 @@ class BaseSettings {
: i18n.resolvedLanguage == null
? 'en'
: i18n.resolvedLanguage.substring(0, 2);
const networkCookie = systemClient.getCookie('settings_network');
this.network = networkCookie !== '' ? networkCookie : 'mainnet';
}
public frontend: 'basic' | 'pro' = 'basic';
@ -44,7 +47,7 @@ class BaseSettings {
public fontSize: number = 14;
public language?: Language;
public freezeViewports: boolean = false;
public network: 'mainnet' | 'testnet' | undefined = 'testnet';
public network: 'mainnet' | 'testnet' | undefined = 'mainnet';
public coordinator: Coordinator | undefined = undefined;
public host?: string;
public unsafeClient: boolean = false;

View File

@ -50,6 +50,7 @@ const App = () => {
loadCookie('settings_fontsize_basic');
loadCookie('settings_language');
loadCookie('settings_mode');
loadCookie('settings_network');
loadCookie('enc_priv_key').then(() => injectMessageResolve(reponseId));
};