pilotwings/frontend/views/Containers.vue

42 lines
876 B
Vue
Raw Normal View History

<template>
<Loading class="container" :loading="loading">
<Message v-if="error" type="danger">Error loading containers</Message>
<ul v-if="!loading && !error">
<li v-for="container in containers" :key="container.name">
{{ container.name }}
</li>
</ul>
</Loading>
</template>
<script lang="ts">
import Loading from '@/components/Loading.vue'
import Message from '@/components/Message.vue'
import axios from 'axios'
export default {
2024-11-02 21:43:27 +00:00
name: 'Containers',
components: {
Loading,
Message,
},
data() {
return {
containers: [],
error: false,
loading: true,
}
},
async mounted() {
try {
this.containers = await axios.get(`${this.$api}/api/containers`)
} catch (error) {
console.error(error)
this.error = true
} finally {
this.loading = false
}
},
}
</script>