This commit is contained in:
2026-08-08 23:51:05 +02:00
commit bb7a17a874
73 changed files with 15038 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
<script setup>
import { Card, Btn } from "@3ba/vue";
import Alert from "../components/Alert.vue"
</script>
<template>
<div style="display: flex; flex-direction: column; gap: 20px;">
<template v-for="hearsay in news">
<Alert style="display: flex; text-align: left;" :tone="info ? 'info' : 'warn'" :timestamp="hearsay.updated_at" :title="hearsay.title + ' (' + hearsay.author + ')'"
v-if="(hearsay.type==='important' && important) || (hearsay.type==='info' && info)">{{ hearsay.body }}</Alert>
</template>
<h2 v-if="!has_important && important">Nincs semmi halaszthatatlan hír</h2>
<h2 v-if="!has_info && info">Nincs semmi tájékoztató jellegű hír</h2>
</div>
</template>
<script>
import axios from 'axios';
let interval;
export default {
data() {
return {
news: [],
has_info: false,
has_important: false,
}
},
props: {
important: {
type: Boolean,
default: false,
},
info: {
type: Boolean,
default: false,
},
},
mounted() {
const call = () =>
{
axios
.get('/api/fetch_news')
.then(response => {
this.news = response.data;
for (const i of response.data) {
if (i.type=='info') this.has_info = true;
if (i.type=='important') this.has_important = true;
}
});
}
call();
interval = setInterval( call , 10000 );
},
unmounted() {
clearInterval(interval);
}
};
</script>
<style scoped>
div {
text-align: left !important;
}
</style>