Skip to content
Snippets Groups Projects
Commit 511f2365 authored by Xiao Gui's avatar Xiao Gui
Browse files

hotfix: fallback backend_url

parent 58170dc5
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,8 @@ export class AtlasViewerConstantsServices implements OnDestroy { ...@@ -57,7 +57,8 @@ export class AtlasViewerConstantsServices implements OnDestroy {
prevLandmarks.length === newLandmarks.length prevLandmarks.length === newLandmarks.length
} }
public backendUrl = BACKEND_URL // instead of using window.location.href, which includes query param etc
public backendUrl = BACKEND_URL || `${window.location.origin}${window.location.pathname}`
/* to be provided by KG in future */ /* to be provided by KG in future */
public templateUrlsPr : Promise<string[]> = new Promise((resolve, reject) => { public templateUrlsPr : Promise<string[]> = new Promise((resolve, reject) => {
......
...@@ -46,14 +46,14 @@ export class KgSingleDatasetService implements OnDestroy{ ...@@ -46,14 +46,14 @@ export class KgSingleDatasetService implements OnDestroy{
public datasetHasPreview({ name } : { name: string } = { name: null }){ public datasetHasPreview({ name } : { name: string } = { name: null }){
if (!name) throw new Error('kgSingleDatasetService#datasetHashPreview name must be defined') if (!name) throw new Error('kgSingleDatasetService#datasetHashPreview name must be defined')
const _url = new URL(`${this.constantService.backendUrl}datasets/hasPreview`) const _url = new URL(`datasets/hasPreview`, this.constantService.backendUrl )
const searchParam = _url.searchParams const searchParam = _url.searchParams
searchParam.set('datasetName', name) searchParam.set('datasetName', name)
return this.http.get(_url.toString()) return this.http.get(_url.toString())
} }
public getInfoFromKg({ kgId, kgSchema = 'minds/core/dataset/v1.0.0' }: Partial<KgQueryInterface>) { public getInfoFromKg({ kgId, kgSchema = 'minds/core/dataset/v1.0.0' }: Partial<KgQueryInterface>) {
const _url = new URL(`${this.constantService.backendUrl}datasets/kgInfo`) const _url = new URL(`datasets/kgInfo`, this.constantService.backendUrl )
const searchParam = _url.searchParams const searchParam = _url.searchParams
searchParam.set('kgSchema', kgSchema) searchParam.set('kgSchema', kgSchema)
searchParam.set('kgId', kgId) searchParam.set('kgId', kgId)
...@@ -65,7 +65,7 @@ export class KgSingleDatasetService implements OnDestroy{ ...@@ -65,7 +65,7 @@ export class KgSingleDatasetService implements OnDestroy{
} }
public getDownloadZipFromKgHref({ kgSchema = 'minds/core/dataset/v1.0.0', kgId }){ public getDownloadZipFromKgHref({ kgSchema = 'minds/core/dataset/v1.0.0', kgId }){
const _url = new URL(`${this.constantService.backendUrl}datasets/downloadKgFiles`) const _url = new URL(`datasets/downloadKgFiles`, this.constantService.backendUrl)
const searchParam = _url.searchParams const searchParam = _url.searchParams
searchParam.set('kgSchema', kgSchema) searchParam.set('kgSchema', kgSchema)
searchParam.set('kgId', kgId) searchParam.set('kgId', kgId)
......
...@@ -69,7 +69,7 @@ module.exports = { ...@@ -69,7 +69,7 @@ module.exports = {
PRODUCTION: process.env.PRODUCTION PRODUCTION: process.env.PRODUCTION
? true ? true
: false, : false,
BACKEND_URL: JSON.stringify(process.env.BACKEND_URL || ''), BACKEND_URL: (process.env.BACKEND_URL && JSON.stringify(process.env.BACKEND_URL)) || 'null',
USE_LOGO: JSON.stringify(process.env.USE_LOGO || 'hbp' || 'ebrains' ) USE_LOGO: JSON.stringify(process.env.USE_LOGO || 'hbp' || 'ebrains' )
}) })
], ],
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment