Don't redirect with folder id in GET param if we're on root

parent a12400f6
...@@ -119,7 +119,6 @@ ...@@ -119,7 +119,6 @@
this.loading = true; this.loading = true;
axios.get(route('api.media.media.find', {media: this.$route.params.mediaId})) axios.get(route('api.media.media.find', {media: this.$route.params.mediaId}))
.then(response => { .then(response => {
console.log(response);
this.loading = false; this.loading = false;
this.media = response.data.data; this.media = response.data.data;
this.tags = response.data.data.tags; this.tags = response.data.data.tags;
...@@ -150,11 +149,14 @@ ...@@ -150,11 +149,14 @@
}); });
}, },
onCancel() { onCancel() {
if (this.media.folder_id == 0) {
this.$router.push({name: 'admin.media.media.index', query: {}});
return;
}
this.$router.push({name: 'admin.media.media.index', query: {folder_id: this.media.folder_id}}) this.$router.push({name: 'admin.media.media.index', query: {folder_id: this.media.folder_id}})
}, },
}, },
mounted() { mounted() {
console.log('received ' + this.$route.params.mediaId);
if (this.$route.params.mediaId !== undefined) { if (this.$route.params.mediaId !== undefined) {
this.fetchMedia(); this.fetchMedia();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment