From ae51d825ef35af4a9111617263be11021c3975c4 Mon Sep 17 00:00:00 2001 From: Timothy Farrell Date: Tue, 21 Nov 2017 23:51:31 -0600 Subject: [PATCH] Don't try to add an album if the user cancels --- packages/gallery/src/interface/gallery.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/gallery/src/interface/gallery.js b/packages/gallery/src/interface/gallery.js index fc0d710..4d138fb 100644 --- a/packages/gallery/src/interface/gallery.js +++ b/packages/gallery/src/interface/gallery.js @@ -37,11 +37,14 @@ export function GalleryView(vm, model) { } function addAlbum() { - const a = new AlbumType({ - title: prompt('Album Name'), - members: [] - }); - a.save(); + const albumName = prompt('Album Name'); + if (albumName && albumName.trim()) { + const a = new AlbumType({ + title: albumName.trim(), + count: 0 + }); + a.save(); + } } routeChanged.subscribe(function onRouteChange(router, route) {