TEMP Article page implementation

This commit is contained in:
Florian Sylvain
2023-01-09 17:38:10 +01:00
parent 71e305766c
commit a83cff619a
+28
View File
@@ -1,10 +1,38 @@
<script setup lang="ts">
import { getArticles, type Article } from '@/utils/database';
import { onMounted, ref, type Ref } from 'vue';
import { RouterLink } from 'vue-router'
const articles: Ref<Array<Article>> = ref([])
onMounted(async () => {
articles.value = await getArticles('')
})
</script>
<template>
<main>
<RouterLink class="button-primary" to="/articles/new">Créer un article</RouterLink>
<table>
<thead>
<th>Titre</th>
<th>Date création</th>
<th>Tags</th>
<th>Statut</th>
</thead>
<tbody>
<tr v-for="article in articles">
<td>{{ article.title }}</td>
<td>{{ new Date(article.date).toLocaleDateString('fr-FR') }}</td>
<td>{{ article.tags }}</td>
<td>{{`${article.online ? 'En ligne' : 'Hors ligne'}`}}</td>
<RouterLink :to="`articles/edit/${article.titleID}`">
Éditer
</RouterLink>
<button>Supprimer</button>
</tr>
</tbody>
</table>
</main>
</template>