Update CollectionCompose.vue component

pull/1519/head
Daniel Supernault 2019-07-17 23:34:28 -06:00
rodzic 031c93915e
commit a472b5cab1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -30,7 +30,8 @@
</form> </form>
<hr> <hr>
<p> <p>
<button type="button" class="btn btn-primary font-weight-bold btn-block" @click="publish">Publish</button> <button v-if="posts.length > 0" type="button" class="btn btn-primary font-weight-bold btn-block" @click="publish">Publish</button>
<button v-else type="button" class="btn btn-primary font-weight-bold btn-block disabled" disabled>Publish</button>
</p> </p>
<p> <p>
<button type="button" class="btn btn-outline-primary font-weight-bold btn-block" @click="save">Save</button> <button type="button" class="btn btn-outline-primary font-weight-bold btn-block" @click="save">Save</button>
@ -221,6 +222,10 @@ export default {
}, },
publish() { publish() {
if(this.posts.length == 0) {
swal('Error', 'You cannot publish an empty collection');
return;
}
axios.post('/api/local/collection/' + this.collectionId + '/publish', { axios.post('/api/local/collection/' + this.collectionId + '/publish', {
title: this.collection.title, title: this.collection.title,
description: this.collection.description, description: this.collection.description,
@ -228,6 +233,8 @@ export default {
}) })
.then(res => { .then(res => {
window.location.href = res.data; window.location.href = res.data;
}).catch(err => {
swal('Something went wrong', 'There was a problem with your request, please try again later.', 'error');
}); });
}, },