added vue component

This commit is contained in:
2023-09-15 19:58:59 +02:00
parent b3061ad79a
commit 018bbf3918
34 changed files with 4134 additions and 458 deletions
+37
View File
@@ -0,0 +1,37 @@
<script setup>
import { ref, onMounted } from 'vue';
import axios from 'axios';
const feeds = ref([]);
const fetchData = async () => {
try {
const response = await axios.get('feeds', {
headers: {
'Content-Type': 'application/json',
'user-token': localStorage.getItem("user-token")
}
});
feeds.value = response.data.feeds[0].items;
} catch (error) {
console.error('Error fetching data:', error);
}
};
onMounted(() => {
fetchData();
});
</script>
<template>
<div>
<h1>Feeds</h1>
<div id='aricle'>
<template v-for="feed in feeds">
<h2>{{ feed.title }}</h2>
<p v-html='feed.content'></p>
</template>
</div>
</div>
</template>