mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-24 15:08:22 -05:00
✨ feat: use ternary condition statement and add error-handling
This commit is contained in:
parent
2b7e28c963
commit
3be0c65109
@ -5,12 +5,13 @@
|
||||
document.addEventListener(
|
||||
'DOMContentLoaded',
|
||||
() => {
|
||||
let cookie = decodeURIComponent(document.cookie)
|
||||
if (cookie !== '') {
|
||||
document.querySelector('.cookies input').value = cookie
|
||||
} else {
|
||||
try {
|
||||
let cookie = decodeURIComponent(document.cookie)
|
||||
document.querySelector('.cookies input').value =
|
||||
'No cookies has been saved on your system'
|
||||
cookie !== '' ? cookie : 'No cookies have been saved on your system'
|
||||
} catch (error) {
|
||||
console.error('Error decoding cookie:', error)
|
||||
document.querySelector('.cookies input').value = 'Error decoding cookie'
|
||||
}
|
||||
},
|
||||
false
|
||||
|
Loading…
Reference in New Issue
Block a user