Updated home.js

Make sure album newly created on the homepage is properly selected
This commit is contained in:
Bobby Wibowo 2020-04-08 00:54:00 +07:00
parent 2d1db2bd01
commit 456f63d0d8
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
4 changed files with 8 additions and 5 deletions

2
dist/js/home.js vendored

File diff suppressed because one or more lines are too long

2
dist/js/home.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -39,6 +39,7 @@ const page = {
tabs: [],
activeTab: null,
albumSelect: null,
albumSelectOnChange: null,
previewTemplate: null,
dropzone: null,
@ -187,12 +188,13 @@ page.prepareUpload = () => {
document.querySelector('#albumDiv').classList.remove('is-hidden')
page.albumSelect = document.querySelector('#albumSelect')
page.albumSelect.addEventListener('change', () => {
page.albumSelectOnChange = () => {
page.album = parseInt(page.albumSelect.value)
// Re-generate ShareX config file
if (typeof page.prepareShareX === 'function')
page.prepareShareX()
})
}
page.albumSelect.addEventListener('change', page.albumSelectOnChange)
// Fetch albums
page.fetchAlbums()
@ -673,6 +675,7 @@ page.createAlbum = () => {
option.value = response.data.id
option.innerHTML = name
option.selected = true
page.albumSelectOnChange()
swal('Woohoo!', 'Album was created successfully.', 'success')
}).catch(page.onError)

View File

@ -1,5 +1,5 @@
{
"1": "1586199007",
"1": "1586281989",
"2": "1581416390",
"3": "1581416390",
"4": "1581416390",