Skip to content

Commit

Permalink
Fix setSettings host override
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Nov 26, 2022
1 parent b4072b9 commit dccb155
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frontend/src/basic/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
return await data;
};

const fetchInfo = function (setNetwork?: boolean) {
const fetchInfo = function () {
setInfo({ ...info, loading: true });
apiClient.get(baseUrl, '/api/info/').then((data: Info) => {
const versionInfo: any = checkVer(data.version.major, data.version.minor, data.version.patch);
Expand All @@ -192,19 +192,22 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
clientVersion: versionInfo.clientVersion,
loading: false,
});
// Sets Setting network from coordinator API param if accessing via web
if (setNetwork) {
setSettings({ ...settings, network: data.network });
}
});
};

useEffect(() => {
if (open.stats || open.coordinator || info.coordinatorVersion == 'v?.?.?') {
fetchInfo(info.coordinatorVersion == 'v?.?.?');
fetchInfo();
}
}, [open.stats, open.coordinator]);

useEffect(() => {
// Sets Setting network from coordinator API param if accessing via web
if (settings.network == undefined) {
setSettings({ ...settings, network: data.network });
}
}, [info]);

const fetchRobot = function ({ keys = false }) {
const requestBody = {
token_sha256: sha256(robot.token),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/UnsafeAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class UnsafeAlert extends Component {

render() {
const { t } = this.props;
console.log(this.state);

// If alert is hidden return null
if (!this.state.show) {
Expand Down

0 comments on commit dccb155

Please sign in to comment.