Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/web3eye-io/Web3Eye
Browse files Browse the repository at this point in the history
  • Loading branch information
Geapefurit committed Nov 23, 2023
2 parents 1fa1ee7 + 9bb94f8 commit 5b7e73d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dashboard/src/boot/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ declare module '@vue/runtime-core' {
// good idea to move this instance creation inside of the
// "export default () => {}" function below (which runs individually
// for each client)
const api = axios.create({ baseURL: '' })
let baseURL = window.location.origin.replace('dashboard', 'api') + '/api'
if (window.location.hostname.includes('.npool.top')) {
baseURL = window.location.protocol + '//api.web3eye.npool.top' + (window.location.port.length ? ':' + window.location.port : '') + '/api'
}
const api = axios.create({ baseURL: baseURL })

export default boot(({ app }) => {
// for use inside Vue files (Options API) through this.$axios and this.$api
Expand Down
11 changes: 10 additions & 1 deletion webui/src/boot/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ declare module '@vue/runtime-core' {
// good idea to move this instance creation inside of the
// "export default () => {}" function below (which runs individually
// for each client)
const api = axios.create({ baseURL: '' })
let baseURL = window.location.protocol + '//api.' + window.location.hostname + '/api'
if (window.location.hostname.startsWith('www.')) {
baseURL = window.location.origin.replace('www', 'api') + '/api'
}
if (window.location.hostname.includes('.npool.top')) {
baseURL = window.location.protocol + '//api.web3eye.npool.top' + (window.location.port.length ? ':' + window.location.port : '') + '/api'
}

// define
const api = axios.create({ baseURL: baseURL })

export default boot(({ app }) => {
// for use inside Vue files (Options API) through this.$axios and this.$api
Expand Down

0 comments on commit 5b7e73d

Please sign in to comment.