74 lines
1.7 KiB
Vue
74 lines
1.7 KiB
Vue
<template>
|
|
<div v-if="user.authenticated">
|
|
<h1>{{ publisher.Name }}</h1>
|
|
|
|
<div class="ui info message" v-if="loading">
|
|
<icon name="refresh" spin></icon>
|
|
<span v-lang.general.loading></span>
|
|
</div>
|
|
|
|
<div class="ui negative message" v-if="error">
|
|
<div class="header" v-lang.genral.error></div>
|
|
{{ error.message }}
|
|
<p v-if="error.response.data">
|
|
{{ error.response.data.Message }}
|
|
</p>
|
|
</div>
|
|
|
|
<div v-if="!loading && !error">
|
|
|
|
<router-link :to="{ name: 'publisher-edit', params: { id: publisherID} }" class="ui teal labeled icon button" style="float: right;">
|
|
<i class="edit icon"></i>
|
|
<span v-lang.general.edit></span>
|
|
</router-link>
|
|
|
|
<div class="ui list">
|
|
<div class="item">
|
|
<div class="header" v-lang.general.name></div>
|
|
{{ publisher.Name }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import auth from '../auth'
|
|
import {HTTP} from '../http-common'
|
|
|
|
export default {
|
|
name: 'Publisher',
|
|
data () {
|
|
return {
|
|
user: auth.user,
|
|
publisher: {},
|
|
error: '',
|
|
success: '',
|
|
publisherID: this.$route.params.id
|
|
}
|
|
},
|
|
created () {
|
|
this.loadPublisher()
|
|
},
|
|
watch: {
|
|
// call again the method if the route changes
|
|
'$route': 'loadPublisher'
|
|
},
|
|
methods: {
|
|
loadPublisher () {
|
|
this.loading = true
|
|
this.publisher = {}
|
|
HTTP.get(`publishers/` + this.publisherID)
|
|
.then(response => {
|
|
this.publisher = response.data
|
|
this.loading = false
|
|
})
|
|
.catch(e => {
|
|
this.loading = false
|
|
this.error = e
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|