diff --git a/src/views/ShootingView.vue b/src/views/ShootingView.vue index af63ad5..f234215 100644 --- a/src/views/ShootingView.vue +++ b/src/views/ShootingView.vue @@ -150,11 +150,15 @@ const proceedToNext = () => { const keysToRemove = [] for (let i = 0; i < localStorage.length; i++) { const key = localStorage.key(i) - if (key && key.startsWith('photobooth-1x4-') || key.startsWith('photobooth-2x2-')) { + if (key && (key.startsWith('photobooth-1x4-') || key.startsWith('photobooth-2x2-'))) { keysToRemove.push(key) } } - keysToRemove.forEach(key => localStorage.removeItem(key)) + keysToRemove.forEach(key => { + if (key !== null) { + localStorage.removeItem(key) + } + }) // เก็บรูปภาพไว้ใน localStorage localStorage.setItem('photobooth-photos', JSON.stringify(photos.value))