makes axios call to remote api

This commit is contained in:
buttle 2021-10-22 12:00:34 +02:00
parent 8a4693a46f
commit 459b6b0031
4 changed files with 43 additions and 4 deletions

18
index.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div data-vue-component="archive-list">
</div>
<script src="/dist/archive-list.js"></script>
</body>
</html>
<!--
http-server -o
-->

View File

@ -4,6 +4,7 @@
"description": "List arc-hive collections for Omeka",
"main": "webpack.config.js",
"devDependencies": {
"axios": "^0.23.0",
"babel-loader": "^8.2.3",
"vue": "^2.6.14",
"vue-loader": "^15.9.8",

View File

@ -8,17 +8,28 @@ This file is part of ArciveList.
<template>
<div>
<h1>
List of sites
</h1>
<div v-for="site in sites" :key="site.id">
{{ site.title }}
</div>
</div>
</template>
<script>
import axios from 'axios';
export default {
components: {
},
data() {
return {
sites: Array,
};
},
created() {
@ -28,7 +39,16 @@ export default {
},
mounted() {
var self = this;
axios.get('https://collections.arc-hive.zone/api/sites', {
})
.then(function (response) {
self.sites = response.data
//self.$forceUpdate();
})
.catch(function (error) {
console.log(error);
});
},
methods: {

View File

@ -1,7 +1,7 @@
/*
This file is part of LiberaForms.
This file is part of ArchiveList.
# SPDX-FileCopyrightText: 2021 LiberaForms.org
# SPDX-FileCopyrightText: 2021 Hangar.org
# SPDX-License-Identifier: AGPL-3.0-or-later
*/