Skip to content

Commit

Permalink
Actual point of branch and PR fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-i-berry committed Sep 19, 2023
1 parent 8ebde34 commit 49e5c58
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions webapp/src/components/CodeListSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</v-card-actions>
</v-card>
</v-dialog>
<div v-if="!_error">
<v-autocomplete
v-if="options !== null"
:items="options"
Expand All @@ -21,6 +22,10 @@
persistent-hint
return-object
/>
</div>
<div v-else class="error">
<v-text-field :label="props.label" class="text-error" readonly hint="Unable to fetch code list, please see console." persistent-hint/>
</div>
</template>

<script>
Expand All @@ -45,10 +50,11 @@
const options = ref(null);
const selected = ref(null);
const showDialog = ref(false);
const _error = ref(false);
const fetchOptions = async() => {
try {
var apiUrl = "/code_lists/" + props.codeList + ".json"
var apiUrl = `${import.meta.env.VITE_BASE_URL}/code_lists/${props.codeList}.json`;
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
Expand All @@ -57,6 +63,8 @@
options.value = data; // Assuming the API response contains the options in the expected format
} catch (error) {
console.error('Error fetching ' + props.label + ' options:', error);
showDialog.value = true;
_error.value = true;
}
};
Expand All @@ -66,7 +74,7 @@
watch( () => selected.value, (newValue) => {
emit("update.modelValue", newValue);
});
return {selected, options, props, showDialog};
return {selected, options, props, showDialog, _error};
}
});
</script>
2 changes: 1 addition & 1 deletion webapp/src/components/ImportOSCAR.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
const loadCodeList = async (codeList) => {
try{
const clist = await fetch("/code_lists/" + codeList + ".json");
const clist = await fetch(`${import.meta.env.VITE_BASE_URL}/code_lists/${codeList}.json`);
var data = null;
if( clist.ok ){
await clist.json().then( (d) => data = d);
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/StationEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
const loadCodeList = async (codeList) => {
try{
const clist = await fetch("/code_lists/" + codeList + ".json");
const clist = await fetch(`${import.meta.env.VITE_BASE_URL}/code_lists/${codeList}.json`);
var data = null;
if( clist.ok ){
await clist.json().then( (d) => data = d);
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/TopicHierarchySelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/>
</div>
<div v-else class="error">
<v-text-field class="text-error" read-only>{{ errorMessage }}</v-text-field>
<v-text-field class="text-error" readonly>{{ errorMessage }}</v-text-field>
</div>
</template>

Expand Down

0 comments on commit 49e5c58

Please sign in to comment.