mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
frontend: call outbound ip api
This commit is contained in:
parent
cd957460c9
commit
bf7ae3575a
|
@ -8,6 +8,12 @@ export function ping(cb) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function queryOutboundIP(cb) {
|
||||||
|
return axios.get(baseURL + '/api/outbound-ip').then(response => {
|
||||||
|
cb(response.data.outboundIP)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function querySyncStatus(cb) {
|
export function querySyncStatus(cb) {
|
||||||
return axios.get(baseURL + '/api/environment/syncing').then(response => {
|
return axios.get(baseURL + '/api/environment/syncing').then(response => {
|
||||||
cb(response.data.syncing)
|
cb(response.data.syncing)
|
||||||
|
@ -71,7 +77,7 @@ export function querySessions(cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function querySessionSymbols(sessionName, cb) {
|
export function querySessionSymbols(sessionName, cb) {
|
||||||
return axios.get(baseURL + `/api/sessions/${ sessionName }/symbols`, {})
|
return axios.get(baseURL + `/api/sessions/${sessionName}/symbols`, {})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
cb(response.data.symbols || [])
|
cb(response.data.symbols || [])
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@ import Typography from '@material-ui/core/Typography';
|
||||||
import Paper from '@material-ui/core/Paper';
|
import Paper from '@material-ui/core/Paper';
|
||||||
import PlainLayout from '../../layouts/PlainLayout';
|
import PlainLayout from '../../layouts/PlainLayout';
|
||||||
import {QRCodeSVG} from 'qrcode.react';
|
import {QRCodeSVG} from 'qrcode.react';
|
||||||
|
import {queryOutboundIP} from '../../api/bbgo';
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
paper: {
|
paper: {
|
||||||
|
@ -21,7 +22,9 @@ const useStyles = makeStyles((theme) => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function fetchConnectUrl(cb) {
|
function fetchConnectUrl(cb) {
|
||||||
cb(window.location.protocol + "//" + window.location.host)
|
return queryOutboundIP((outboundIP) => {
|
||||||
|
cb(window.location.protocol + "//" + outboundIP + ":" + window.location.port)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Connect() {
|
export default function Connect() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user