WIP: feat(HomeView): use salix for news #118
|
@ -1,16 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, inject } from 'vue';
|
import { ref, onMounted, inject } from 'vue';
|
||||||
const jApi = inject('jApi');
|
const jApi = inject('jApi');
|
||||||
|
const api = inject('api');
|
||||||
const news = ref([]);
|
const news = ref([]);
|
||||||
const showPreview = ref(false);
|
const showPreview = ref(false);
|
||||||
const selectedImageSrc = ref('');
|
const selectedImageSrc = ref('');
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
news.value = await jApi.query(
|
const newsResponse = await api.get('News');
|
||||||
`SELECT title, text, image, id
|
|
||||||
FROM news
|
news.value = newsResponse.data;
|
||||||
ORDER BY priority, created DESC`
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showImagePreview = src => {
|
const showImagePreview = src => {
|
||||||
|
|
Loading…
Reference in New Issue