Skip to content
Snippets Groups Projects
Commit a0cdcbeb authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Deal with baseUrl runtime config for url

parent 31a71570
No related branches found
No related tags found
1 merge request!9Resolve "Add Js plugin to render 3D protein structure"
Pipeline #112022 passed
<script setup lang="ts">
import { withTrailingSlash, withLeadingSlash, joinURL } from 'ufo'
import { useRuntimeConfig, computed } from '#imports'
export interface Props {
height?: number
dataUrl: string
}
const refinedDataUrl = computed(() => {
if (props.dataUrl?.startsWith('/') && !props.dataUrl.startsWith('//')) {
const _base = withLeadingSlash(withTrailingSlash(useRuntimeConfig().app.baseURL))
if (_base !== '/' && !props.dataUrl.startsWith(_base)) {
return joinURL(_base, props.dataUrl)
}
}
return props.dataUrl
})
const props = withDefaults(defineProps<Props>(), {
height: 600,
})
......@@ -28,7 +40,7 @@ useHead({
<template>
<v-card flat color="transparent" :min-height="height" position="relative" class="my-3">
<pdbe-molstar :custom-data-url="dataUrl" custom-data-format="pdb" alphafold-view="true" landscape="true"
<pdbe-molstar :custom-data-url="refinedDataUrl" custom-data-format="pdb" alphafold-view="true" landscape="true"
hide-expand-icon sequence-panel></pdbe-molstar>
</v-card>
</template>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment