<script>
    import axios from "axios";
    export default {
        name: "ScheduleTable",
        data: () => ({
            schedules: []
        }),
        methods: {
            parseDate(date){
                let dateArr = date.split("-");
                return dateArr[2] + "." + dateArr[1];
            }
        },
        mounted() {
            axios
                .get('/api/v1/schedules')
                .then(response => (this.schedules = response.data));
        }
    }
</script>

<template>
    <div class="w-100 d-flex justify-center">
        <v-table class="text-h5 w-66">
            <tbody>
            <tr v-for="schedule in schedules">
                <td>{{ parseDate(schedule.current_date) }} {{ schedule.weekday_name }} {{ schedule.stream_time }}</td>
                <td>{{ schedule.name }}</td>
            </tr>
            </tbody>
        </v-table>
    </div>
</template>

<style scoped>

</style>
