A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: db145c84cb4357bddea8910330a9cd7f34d121ce (1685 bytes)[doc][blame][raw]
1
import {$lang, http} from '../utils.js';2
import VIcon from '../element/icon.js';3
import VTab from '../component/tab.js';4
import VStation from '../component/station.js';6
export default {7
props: ['state'],8
data() {9
return {10
results: [],11
loading: false12
};13
},14
components: {15
VIcon,16
VTab,17
VStation18
},19
methods: {20
$lang,21
async doFetch() {22
this.results = [];23
this.loading = true;24
const result = await http`get::/api/favorite`();25
this.loading = false;26
this.results = result;27
}28
},29
mounted() {30
this.doFetch();31
},32
template: `33
<v-tab id="favorites" :tab="state.tab">34
<div class="pb-8 sm:pb-[100px] pt-2">35
<ul class="flex flex-col">36
<li37
:key="station.id"38
v-for="station in results"39
class="border-t sm:border-t-2 first:border-none border-zinc-900 py-4 first:pt-0"40
>41
<v-station :station="station"></v-station>42
</li>43
</ul>44
<div45
v-show="loading"46
class="w-[60px] h-[60px] select-none pointer-events-none mx-auto"47
>48
<v-icon49
id="loader"50
class="text-gray-400 animate-spin"51
style="animation-duration: 2s;"52
size="44px"53
></v-icon>54
</div>55
</div>56
</v-tab>57
`58
}