Replace nested if with early return.

This commit is contained in:
voussoir 2020-09-20 12:15:01 -07:00
parent 5c4c0a3034
commit 00bc7e6eac

View file

@ -426,8 +426,11 @@ function on_album_drag_drop(event)
const child_title = child.querySelector('.album_card_title').textContent.trim();
const parent_title = parent.querySelector('.album_card_title').textContent.trim();
if (confirm(`Move\n${child_title}\ninto\n${parent_title}?`))
const prompt = `Move\n${child_title}\ninto\n${parent_title}?`;
if (! confirm(prompt))
{
return;
}
if (ALBUM_ID)
{
api.albums.add_child(parent_id, child_id, null);
@ -438,6 +441,5 @@ function on_album_drag_drop(event)
api.albums.add_child(parent_id, child_id, common.refresh);
}
}
}
</script>
</html>