mirror of https://github.com/pixelfed/pixelfed.git
Add check if collection is empty before publishing
This commit is contained in:
parent
65a048cdd5
commit
fdb51d1f5a
|
@ -205,12 +205,20 @@
|
|||
|
||||
<div v-else class="float-right">
|
||||
<button
|
||||
v-if="posts.length > 0"
|
||||
type="button"
|
||||
class="btn btn-outline-primary btn-sm py-1 font-weight-bold px-3"
|
||||
@click.prevent="publishCollection">
|
||||
Publish
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-else
|
||||
type="button"
|
||||
class="btn btn-outline-primary btn-sm py-1 font-weight-bold px-3 disabled" disabled>
|
||||
Publish
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary btn-sm py-1 font-weight-bold px-3"
|
||||
|
@ -527,6 +535,11 @@ export default {
|
|||
},
|
||||
|
||||
publishCollection() {
|
||||
if (this.posts.length === 0) {
|
||||
swal('Error', 'You cannot publish an empty collection');
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.owner == false) {
|
||||
return;
|
||||
}
|
||||
|
@ -541,7 +554,9 @@ export default {
|
|||
.then(res => {
|
||||
console.log(res.data);
|
||||
// window.location.href = res.data.url;
|
||||
});
|
||||
}).catch(err => {
|
||||
swal('Something went wrong', 'There was a problem with your request, please try again later.', 'error')
|
||||
});
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue