replaces endpoint with base_url

This commit is contained in:
buttle 2021-10-22 13:05:02 +02:00
parent 5cfebf5ef0
commit 15d05fe0e0
3 changed files with 12 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<body> <body>
<div data-vue-component="archive-list" <div data-vue-component="archive-list"
data-endpoint="https://dev-archive.hangar.org/api"> data-base_url="https://dev-archive.hangar.org">
</div> </div>
<script src="/dist/archive-list.js"></script> <script src="/dist/archive-list.js"></script>

View File

@ -15,7 +15,10 @@ This file is part of ArciveList.
<template v-for="site in sites"> <template v-for="site in sites">
<div v-if="site['o:is_public'] && site['o:title'] != 'Collections'" <div v-if="site['o:is_public'] && site['o:title'] != 'Collections'"
:key="site.id"> :key="site.id">
<a :href="site_url(site['o:slug'])">
{{ site['o:title'] }} {{ site['o:title'] }}
</a>
</div> </div>
</template> </template>
</div> </div>
@ -43,7 +46,7 @@ export default {
}, },
mounted() { mounted() {
var self = this; var self = this;
axios.get(this.endpoint +'/sites', { axios.get(this.api_endpoint +'/sites', {
}) })
.then(function (response) { .then(function (response) {
console.log(response.data) console.log(response.data)
@ -54,13 +57,17 @@ export default {
}); });
}, },
methods: { methods: {
site_url: function(slug) {
return this.base_url + '/s/' + slug
}
}, },
watched: { watched: {
}, },
computed: { computed: {
api_endpoint: function() {
return this.base_url + '/api'
},
} }
}; };
</script> </script>

View File

@ -30,7 +30,7 @@ document.querySelectorAll("[data-vue-component=archive-list]")
new ComponentClass({ new ComponentClass({
components: {'ArchiveList': ArchiveList}, components: {'ArchiveList': ArchiveList},
propsData: { ...element.dataset }, propsData: { ...element.dataset },
props: ["endpoint"], props: ["base_url"],
/* /*
store: store, store: store,
i18n: i18n, i18n: i18n,