49 lines
No EOL
1,021 B
Vue
49 lines
No EOL
1,021 B
Vue
<script setup lang="ts">
|
|
import {DateTime} from "luxon";
|
|
import {useAuthStore} from "@/stores/auth.store.ts";
|
|
import {ref} from "vue";
|
|
import axios, {type AxiosResponse} from "axios";
|
|
|
|
const auth = useAuthStore();
|
|
const timezone = auth.userData.timezone;
|
|
|
|
const color = ref("secondary");
|
|
|
|
const isOnAir = async (): void => {
|
|
const now = DateTime.now().setZone(import.meta.env.VITE_APP_TIMEZONE).toISO();
|
|
return await axios.get(`/schedule`, {
|
|
params: {
|
|
ends: now,
|
|
start: now,
|
|
}
|
|
}).then((response: AxiosResponse) => {
|
|
if (typeof response.data === Array && response.data.length > 0) {
|
|
color.value = 'error';
|
|
}
|
|
}).catch((error) => {
|
|
console.error(error)
|
|
})
|
|
}
|
|
|
|
setInterval(isOnAir, 1000);
|
|
</script>
|
|
|
|
<template>
|
|
<v-sheet
|
|
:width="100"
|
|
border
|
|
rounded
|
|
:color="color"
|
|
>
|
|
{{ $t('header.onair') }}
|
|
</v-sheet>
|
|
</template>
|
|
|
|
<style scoped>
|
|
div {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: .625rem;
|
|
}
|
|
</style> |