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>
<div data-vue-component="archive-list"
data-endpoint="https://dev-archive.hangar.org/api">
data-base_url="https://dev-archive.hangar.org">
</div>
<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">
<div v-if="site['o:is_public'] && site['o:title'] != 'Collections'"
:key="site.id">
<a :href="site_url(site['o:slug'])">
{{ site['o:title'] }}
</a>
</div>
</template>
</div>
@ -43,7 +46,7 @@ export default {
},
mounted() {
var self = this;
axios.get(this.endpoint +'/sites', {
axios.get(this.api_endpoint +'/sites', {
})
.then(function (response) {
console.log(response.data)
@ -54,13 +57,17 @@ export default {
});
},
methods: {
site_url: function(slug) {
return this.base_url + '/s/' + slug
}
},
watched: {
},
computed: {
api_endpoint: function() {
return this.base_url + '/api'
},
}
};
</script>

View File

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