60 lines
1.2 KiB
Vue
60 lines
1.2 KiB
Vue
|
<template>
|
||
|
<div v-if="user.authenticated">
|
||
|
<h1>{{ booksTitle }}</h1>
|
||
|
<table class="ui celled table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Title</th>
|
||
|
<th>ISBN</th>
|
||
|
<th>Year</th>
|
||
|
<th>Price</th>
|
||
|
<th>Status</th>
|
||
|
<th>Publisher</th>
|
||
|
<th>Actions</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr v-for="book in books">
|
||
|
<td>{{ book.Title }}</td>
|
||
|
<td>{{ book.Isbn }}</td>
|
||
|
<td>{{ book.Year }}</td>
|
||
|
<td>{{ book.Price }}€</td>
|
||
|
<td>{{ book.Status }}</td>
|
||
|
<td>{{ book.PublisherFull.Name }}</td>
|
||
|
<td><a class="button">Do</a> </td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import auth from '../auth'
|
||
|
import {HTTP} from '../http-common'
|
||
|
|
||
|
export default {
|
||
|
name: 'Home',
|
||
|
data () {
|
||
|
return {
|
||
|
user: auth.user,
|
||
|
booksTitle: 'Books Overview',
|
||
|
books: []
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
logout () {
|
||
|
auth.logout()
|
||
|
}
|
||
|
},
|
||
|
created () {
|
||
|
HTTP.get(`books`)
|
||
|
.then(response => {
|
||
|
this.books = response.data
|
||
|
})
|
||
|
.catch(e => {
|
||
|
this.errors.push(e)
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
</script>
|