Проверьте, есть ли данные в LocalStorage
if (localStorage.getItem('ID') !== null) {
console.log(` exists`);
} else {
console.log(`not found`);
}
Dentetsu
if (localStorage.getItem('ID') !== null) {
console.log(` exists`);
} else {
console.log(`not found`);
}