Pretty URL for channels even if initially loaded with uuid

This commit is contained in:
Eliot Berriot 2020-03-11 16:34:49 +01:00
parent ad9a003024
commit c41f6f1c01
No known key found for this signature in database
GPG Key ID: 6B501DFD73514E14
1 changed files with 9 additions and 0 deletions

View File

@ -268,6 +268,15 @@ export default {
this.isLoading = true
let channelPromise = axios.get(`channels/${this.id}`).then(response => {
self.object = response.data
if (self.id == response.data.uuid && response.data.actor) {
// replace with the pretty channel url if possible
let actor = response.data.actor
if (actor.is_local) {
self.$router.replace({name: 'channels.detail', params: {id: actor.preferred_username}})
} else {
self.$router.replace({name: 'channels.detail', params: {id: actor.full_username}})
}
}
let tracksPromise = axios.get("tracks", {params: {channel: response.data.uuid, page_size: 1, playable: true, include_channels: true}}).then(response => {
self.totalTracks = response.data.count
self.isLoading = false