Skip to content
Snippets Groups Projects
Unverified Commit 3fdcaa56 authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #415 from HumanBrainProject/hotfix/fallbackBackendUrl

hotfix: fallback backend_url
parents 58170dc5 511f2365
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,8 @@ export class AtlasViewerConstantsServices implements OnDestroy {
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 */
public templateUrlsPr : Promise<string[]> = new Promise((resolve, reject) => {
......
......@@ -46,14 +46,14 @@ export class KgSingleDatasetService implements OnDestroy{
public datasetHasPreview({ name } : { name: string } = { name: null }){
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
searchParam.set('datasetName', name)
return this.http.get(_url.toString())
}
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
searchParam.set('kgSchema', kgSchema)
searchParam.set('kgId', kgId)
......@@ -65,7 +65,7 @@ export class KgSingleDatasetService implements OnDestroy{
}
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
searchParam.set('kgSchema', kgSchema)
searchParam.set('kgId', kgId)
......
......@@ -69,7 +69,7 @@ module.exports = {
PRODUCTION: process.env.PRODUCTION
? true
: 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' )
})
],
......
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