40 lines
943 B
Vue
40 lines
943 B
Vue
<script setup>
|
|
import Wish from '../components/Wish.vue';
|
|
import {ref, onMounted} from 'vue';
|
|
import axios from 'axios';
|
|
import TopFleur from '../components/TopFleur.vue';
|
|
import WishPanel from '../components/WishPanel.vue';
|
|
|
|
let interval;
|
|
|
|
const wishes = ref([]);
|
|
const selected = ref(-1);
|
|
|
|
const call = () => {
|
|
axios
|
|
.get('/api/get_wishes')
|
|
.then(response => {
|
|
wishes.value = response.data;
|
|
})
|
|
}
|
|
|
|
function selectedWish(index) {
|
|
selected.value = index;
|
|
}
|
|
|
|
onMounted(() => {
|
|
call();
|
|
interval = setInterval(call, 10000);
|
|
})
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<TopFleur></TopFleur>
|
|
<body>
|
|
<template v-for="(wish, i) in wishes">
|
|
<Wish :wish="wish" :selected="selected==i" :index="i" @selectedWish="selectedWish" v-if="selected == i || selected == -1"/>
|
|
<WishPanel :wish="wish" v-if="selected == i" @closeWish="selected = -1"></WishPanel>
|
|
</template>
|
|
</body>
|
|
</template> |